본문 바로가기

백준 문제풀이6

[백준/C++] 2755번 부녀회장이 될테야 문제 : www.acmicpc.net/problem/5622 #include using namespace std; int apartM[15][14] ; int findRoomMember(int floor, int room) { if (floor==0||room==0) { return ++room; } else { return findRoomMember(floor-1, room) + findRoomMember(floor, room-1); } } int main() { int count, i; cin >> count; for (i = 0; i > k >> n; cout 2020. 11. 14.
[백준/C++] 2869번 달팽이는 올라가고 싶다 문제 : www.acmicpc.net/problem/2869 #include using namespace std; int main()//2869번 달팽이는 올라가고 싶어 { int A, B, V; cin >> A >> B >> V; int R = (V - A) % (A - B); int Q = (V - A) / (A - B); if (R == 0) { cout 2020. 11. 8.
[백준/C++] 2922번 벌집 문제 : www.acmicpc.net/problem/2922 #include #include using namespace std; int main() { long long input; cin >> input; int N = ((-3 + (sqrt(12 * input - 3))) / (6)); if (input == 6 * (((N * (N + 1)) / 2)) + 1) { printf("%d\n", N + 1); } else { printf("%d\n", N + 2); } return 0; } 이거 백퍼 이렇게 푸는거 아닐텐데......ㅋㅋㅋㅋㅋㅋㅋ 이리저리 복잡하게 설명해놨지만 결국 근의 공식을 이용하여 n의 값을 찾고 n과 n의 합을 이용하여 입력값의 위치를 찾는 문제였다. 2020. 11. 7.
[백준/C++] 5622번 다이얼 문제 : www.acmicpc.net/problem/5622 #include using namespace std; //A는 65 Z는 90 int main() { string input; cin >> input; int time = 0; for (int i = 0; i < input.size(); i++) { time += 2; time += (((int)input[i] - 65) / 3) + 1; if (input[i] == 'Z' || input[i] == 'V' || input[i] == 'S' || input[i] == 'Y') time--; } cout 2020. 11. 7.
[백준/C++] 2941번 크로아티아 알파벳 문제 : www.acmicpc.net/problem/2941 #include using namespace std; int main() { string input; cin >> input; int count = input.size(); for (int i = 1; i 1)&&(input[i - 1] == 'z')&& (input[i - 2] == 'd')) {count--;} } else if (input[i] == '-') { if (input[i - 1] == 'c' || inp.. 2020. 11. 7.
[백준/C++] 1193번 분수찾기 문제 : www.acmicpc.net/problem/1193 #include #include using namespace std; int main() { int input; cin >> input; int N = (-1 + (sqrt(1 + 8 * input)))/(2); // 근의 공식 사용 int sumN = ((N * (N + 1)) / 2); // N의 합 int ascN, descN; if (input == sumN) { ascN = 1; descN = N; } else { ascN = input - sumN; descN = N + 2 - ascN; } if (N % 2 != 0) { printf("%d/%d", ascN, descN); } else { printf("%d/%d", descN, .. 2020. 11. 4.