본문 바로가기

누적합14

AtCoder ABC 238 D,E 재밌는 문제들입니다. D. https://atcoder.jp/contests/abc238/tasks/abc238_d D - AND and SUM AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp x & y = a , x+y=s인 (x,y)가 존재하는지 O(1)에 판정해봅시다. x & y = a이므로, x>=a, y>=a 입니다. x=x1+a, y=y1+a라고 두면, x1 & y1 = 0입니다. 이제 x1 & y1 = 0이고, x1+y1=s-2a인 x1,y1이 존재하는지 알아봅시다. x1과 y1을 이진법으로 썼을 때, a를 .. 2022. 10. 2.
AtCoder ABC 269 풀이 https://atcoder.jp/contests/abc269/tasks Tasks - UNICORN Programming Contest 2022(AtCoder Beginner Contest 269) AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. (a+b)*(c-d)와 문자열 하나를 출력해주면 됩니다. #include using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int a, b, c, d; cin >> a >> b >> c >> d;.. 2022. 9. 18.
AtCoder Educational DP Contest M~Q https://atcoder.jp/contests/dp/tasks Tasks - Educational DP Contest AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp M. dp[i][j]를 i번째 학생까지 합이 j가 되게 나눠주는 경우의 수라고 정의합니다. dp[i][j]는 dp[i-1][j-k]들의 합입니다. (k=0 ~ a[i]) 이 식을 navie 하게 계산하면 O(NK^2)입니다. dp[i][j]들의 합을 미리 계산해놓아 k=0~a[i]까지 합을 O(1)에 구할 수 있습니다. 그리고 dp식을 갱신할 때 i와 i.. 2022. 9. 16.
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.