정수론14 AtCoder ABC 254 풀이 https://atcoder.jp/contests/abc254/tasks Tasks - AtCoder Beginner Contest 254 AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. 숫자를 문자열로 받은 후 s[1]과 s[2]를 출력해주면 됩니다. #include using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); string s; cin >> s; cout n; for (int i = 1; i > a[i]; b[i % k].push_b.. 2022. 9. 12. AtCoder ABC 253 풀이 https://atcoder.jp/contests/abc253/tasks Tasks - NOMURA Programming Contest 2022(AtCoder Beginner Contest 253) AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. 항상 a> b >> c; if (a > c) swap(a, c); if (a w; vectorv; for (int i = 0; i > s; if (s == 'o') { v.pu.. 2022. 9. 12. 백준 14398 / C++ https://www.acmicpc.net/problem/14398 14398번: 피타고라스 수 피타고라스 수 (a, b, c)는 다음과 같은 조건을 만족하는 세 쌍이다. a, b, c는 정수이다. a^2 + b^2 = c^2 a와 b의 최대 공약수는 1이다. 영선이는 나무 막대 N개를 가지고 있다. 영선이는 직각 삼각형 모 www.acmicpc.net [ 풀이 ] 이분그래프 모델링을 해보자. 수학적 지식이 좀 필요하다. 만약 a^2+b^2=c^2에서 a, b가 짝수라면, gcd에 모순이다. a, b가 모두 홀수라면 홀수의 제곱은 4로 나눈 나머지가 항상 1이다. 따라서 c^2은 4로 나눈 나머지가 2인 짝수가 되어 모순이다. ( 제곱수는 mod4로 0,1만 가능) (원시 피타고라스 세쌍을 알고 있다면 .. 2022. 8. 17. 백준 11616 / C++ https://www.acmicpc.net/problem/11616 11616번: Digit Division We are given a sequence of n decimal digits. The sequence needs to be partitioned into one or more contiguous subsequences such that each subsequence, when interpreted as a decimal number, is divisible by a given integer m. Find the number of different suc www.acmicpc.net [ 풀이 ] 우선 짚고갈 것은 전체수가 m의 배수가 아니라면 m의 배수인 여러부분으로 분할할 수 없다. 이제 전체수.. 2022. 8. 12. 이전 1 2 3 4 다음