일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- js #예약어 #자바스크랩트
- 사이드프로젝트 #토이프로젝트 #개발 #개발자
- js #제이쿼리 #비동기통신 #코딩 #프로그래밍
- 라이엇 #api #롤api
- 깃허브 #깃 #커밋
- 롤 #리그오브레전드
- 코드업 #코딩문제
- ci #개발 #git
- js #web
Archives
- Today
- Total
Just Do it
코딩테스트 합격자 되자 3주차 과제 본문
1번문제
#include <stdio.h>
int sum(int num);
int main(void)
{
int num;
scanf_s("%d", &num);
printf("%d", sum(num));
return 0;
}
int sum(int num)
{
if (num == 0)
return 0;
else if (num > 0)
return num + sum(num - 1);
}
2번문제
#include <iostream>
using namespace std;
int pow(int a, int n) {
if (n == 0)
return 1;
else
return a * pow(a, n - 1);
}
int main() {
int a, n;
cout << "a: ";
cin >> a;
cout << "n: ";
cin >> n;
cout << "결과: " << pow(a, n) << endl;
return 0;
}
3번 문제
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string n;
cin>>n;
reverse(n.begin(), n.end());
cout<<"문자열뒤집기"<<n<<endl;
return 0;
}
4번 문제
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void permute(string input, string current = "") {
if (input.empty()) {
cout << current << endl;
} else {
for (size_t i = 0; i < input.length(); ++i) {
string remaining = input.substr(0, i) + input.substr(i + 1); // 0부터 i까지 출력 i다음까지 출력 합친다
permute(remaining, current + input[i]);// 순열 한것을 반복해서 출력한다
}
}
}
int main() {
string word;
cout << "순열을 구할 문자열을 입력하세요: ";
cin >> word;
permute(word);
return 0;
}
https://cafe.naver.com/dremdeveloper
매일 알고리즘 : 네이버 카페
공부하면서 필요한 내용을 정리하고 있어요, 코딩테스트 알고리즘 자료구조 개발 C언어 Cpp 디자인패턴
cafe.naver.com
https://open.kakao.com/o/gX0WnTCf
<코딩 테스트 합격자 되기>(파이썬 편) - 저자방
open.kakao.com
'개발 공부' 카테고리의 다른 글
라이엇 api 가지고 놀기 (0) | 2025.01.10 |
---|---|
코딩테스트 합격자 되자 4주차 과제 (0) | 2024.01.02 |