발상7 codeforces #580 div2 C - Almost Eqaul (발상) https://codeforces.com/contest/1206/problem/C 1 ~ 2*n 까지의 숫자를 나열하는데 연속된 n개의 부분합이 모두 같도록 나열하는 문제다. n==3) x y z x+1 y-1 z+1 n==5) x y z w d x+1 y-1 z+1 w-1 d+1 ... 위와 같은 패턴이면 된다. 위 패턴만 만족시키면 문제 조건을 만족하게 된다. 나는 추가로 구간의 합이 모두 같음도 생각해야 되는 줄 알아서 삽질을 좀 했다. #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; if (n % 2) { cout 2019. 11. 13. SW 8568 - 3으로 나눈 순열 (발상) https://suuntree.tistory.com/75?category=797985 koi 모양정돈에서 썻던 논리와 같은 논리로 풀 수 있다. https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AW1B8rJq3NUDFARC&categoryId=AW1B8rJq3NUDFARC&categoryType=CODE #include #include using namespace std; int main() { int testcase; cin >> testcase; for (int tc = 1; tc > n; for (int i = 1, input; i > input; if (input % 3 != i % 3) arr[i % 3][.. 2019. 11. 3. codeforces #592 div2 C - The Football season(수학, 발상) https://codeforces.com/contest/1244/problem/C n > p >> w >> d; ll x, y=-1; for (ll i = 0; i = 0 && (p - i * d) % w == 0) { if ((p - i * d) / w + i 2019. 10. 31. 이전 1 2 다음