목록생활/코테 (670)
No Rules Rules
문제집 https://www.acmicpc.net/problem/1766 1766번: 문제집 첫째 줄에 문제의 수 N(1 ≤ N ≤ 32,000)과 먼저 푸는 것이 좋은 문제에 대한 정보의 개수 M(1 ≤ M ≤ 100,000)이 주어진다. 둘째 줄부터 M개의 줄에 걸쳐 두 정수의 순서쌍 A,B가 빈칸을 사이에 두고 주 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; vector arr[32001]; int check[32001]{0}; int main() { ios::sync_with_stdio(false), cin.tie(NULL); registe..
ROT13 https://www.acmicpc.net/problem/11655 11655번: ROT13 첫째 줄에 알파벳 대문자, 소문자, 공백, 숫자로만 이루어진 문자열 S가 주어진다. S의 길이는 100을 넘지 않는다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); char S[10001]; int tmp; cin.getline(S, 10001); for(auto& ch : S){ if('a'
심부름 가는 길 https://www.acmicpc.net/problem/5554 5554번: 심부름 가는 길 승균이는 매일 학교, PC방, 학원에 다닌다. 반복되는 일상에 익숙해진 승균이는 이동시간을 단축해서 PC방에 더 오래 머물고 싶었다. 그래서 스톱워치를 들고 이동할 때마다 기록을 잰 후 집 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int ans(0); for(register int i = 0, v; i > v, ans += v; cout
피보나치 수 4 https://www.acmicpc.net/problem/10826 10826번: 피보나치 수 4 피보나치 수는 0과 1로 시작한다. 0번째 피보나치 수는 0이고, 1번째 피보나치 수는 1이다. 그 다음 2번째 부터는 바로 앞 두 피보나치 수의 합이 된다. 이를 식으로 써보면 Fn = Fn-1 + Fn-2 (n ≥ 2)가 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include using namespace std; string ans[10001]{""}; string findSum(string str1, string str2){ // Before proceeding further, make sur..
지능형 기차 https://www.acmicpc.net/problem/2455 2455번: 지능형 기차 최근에 개발된 지능형 기차가 1번역(출발역)부터 4번역(종착역)까지 4개의 정차역이 있는 노선에서 운행되고 있다. 이 기차에는 타거나 내리는 사람 수를 자동으로 인식할 수 있는 장치가 있다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int x, y, total(0), max(0); for(register int i = 0; i > x >> y, ..
사분면 https://www.acmicpc.net/problem/9610 9610번: 사분면 2차원 좌표 상의 여러 점의 좌표 (x,y)가 주어졌을 때, 각 사분면과 축에 점이 몇 개 있는지 구하는 프로그램을 작성하시오. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N, cnt[4]{0}, axis(0); cin >> N; for(register int n = 0, x, y; n > x >> y; if(x == 0 || y == 0) ++axi..
탁구 경기 https://www.acmicpc.net/problem/27918 27918번: 탁구 경기 달구와 포닉스는 탁구 치는 것을 좋아한다. 윤이는 오늘도 탁구를 치는 달구와 포닉스를 보고, 누가 경기에서 승리할지 예측해 보기로 했다. 달구와 포닉스가 탁구 경기를 진행하는 규칙은 다음 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N, point1 = 0, point2 = 0; cin >> N; char ch; queue q; for(r..
다음 소수 https://www.acmicpc.net/problem/4134 4134번: 다음 소수 정수 n(0 ≤ n ≤ 4*109)가 주어졌을 때, n보다 크거나 같은 소수 중 가장 작은 소수 찾는 프로그램을 작성하시오. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register long long N, n, i; bool check = false; cin >> N; while(N--){ cin >> n; while(1){ check = true; if(n == 1) chec..
시그마 https://www.acmicpc.net/problem/2355 2355번: 시그마 첫째 줄에 두 정수 A, B가 주어진다. (-2,147,483,648 ≤ A, B ≤ 2,147,483,647) www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register long long a, b; cin >> a >> b; cout > 1); return 0; } // *&)*@* 두 정수 사이의 모든 값을 더하는 문제로 저도 이번에 새로운 수식을 알게 되었습니다. 독일 수학자인 가..
하얀 칸 https://www.acmicpc.net/problem/1100 1100번: 하얀 칸 체스판은 8×8크기이고, 검정 칸과 하얀 칸이 번갈아가면서 색칠되어 있다. 가장 왼쪽 위칸 (0,0)은 하얀색이다. 체스판의 상태가 주어졌을 때, 하얀 칸 위에 말이 몇 개 있는지 출력하는 프로그램 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int ans = 0; char arr[8][8]; for(register int i = 0, j; i < 8; ++i) for(j = 0; j..