본문 바로가기

map3

AtCoder ABC 239 풀이 https://atcoder.jp/contests/abc239/tasks Tasks - Denso Create Programming Contest 2022(AtCoder Beginner Contest 239) AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. 구하라는 값을 출력해주면 됩니다. long long을 써줍시다. #include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(0), cin.tie(0); ll x; cin.. 2022. 10. 1.
AtCoder ABC 261 풀이 https://atcoder.jp/contests/abc261/tasks Tasks - AtCoder Beginner Contest 261 AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. 두 선분이 겹치는 길이를 구해주면 됩니다. 1. 안 겹치는 경우 2. 1번이 앞에서 겹치는 경우 3. 2번이 앞에서 겹치는 경우 4. 1번이 2번 안에 있는 경우 5. 2번이 1번 안에 있는 경우 5가지를 조건문으로 처리해줍시다. #include using namespace std; int main() { ios::sync_with.. 2022. 9. 1.
백준 25332 / C++ https://www.acmicpc.net/problem/25332 25332번: 수들의 합 8 $A = \{1, 2, 3\}$, $B = \{1, 3, 2\}$로, 조건을 만족하는 $i, j$ 쌍은 $(1, 1), (2, 3), (1, 3)$의 세 가지이다. $A_1$ = $B_1 = 1$ $A_2 + A_3 = B_2 + B_3 = 5$ $A_1 + A_2 + A_3 = B_1 + B_2 + B_3 = 6$ www.acmicpc.net [ 풀이 ] B[i]-A[i]=C[i]라고 하자. C[i]+...+C[j]=0 인 (i,j) 쌍을 구하자. C[i]까지 누적합을 pref[i]라 하면, pref[i-1]==pref[j]인 (i,j)를 구하면 된다. 단순하게 O(N^2)에 구하면 TLE이다. 값과 횟수를.. 2022. 7. 7.