CodeForces17 Codeforces Round #669 (Div. 2) ABC from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): l = int(input()) s = list(map(int, input().split())) r = [] for i in range(l//2): if s[i*2] == 0 and s[i*2+1] == 0: r.append(0); r.append(0); elif s[i*2] == 1 and s[i*2+1] == 1: r.append(1); r.append(1); else: r.append(0); print(len(r)) print(*r) A - Ahahahahahahahaha 입력의 길이가 반드시 2n이라는 점에 근거하여 두 자리씩.. 2020. 9. 9. Codeforces Round #666 (Div. 2) AC #include using namespace std; int TEST; int n; string s; map chars; int cnt[26]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> TEST; while (TEST--) { cin >> n; for (int i = 0; i > s; for (char c : s) { cnt[int(c - 'a')] += 1; } } bool isGood = true; for (int i = 0; i < 26; ++i) { if (cnt[i] % n != 0) isGood = false; cnt[i] = 0; } cout n; for (int i = 1; i.. 2020. 8. 31. Educational Codeforces Round 93 (Rated for Div. 2) AB from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): L=int(input()) s=list(map(int,input().split())) if s[0]+s[1]>s[-1]: print(-1) else: print(1,2,L) A - Bad Triangle 입력이 오름차순이므로 1, 2번과 마지막번만 비교하면 된다. from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): s=input().split("0") for i in range(len(s)): s[i]=len(.. 2020. 8. 15. Codeforces Round #663 (Div. 2) ABC from sys import stdin def input(): return stdin.readline().rstrip() for i in range(int(input())): n=int(input()) for _ in range(1,n+1): print(_,end=" ") print() A - Suborrays 0분에 제출한 사람이 너무 많아서 단순히 n까지 출력하는 도박을 했고 AC를 받았다. from sys import stdin def input(): return stdin.readline().rstrip() T=int(input()) for i in range(T): res=0 r,c=map(int,input().split()) for j in range(r): line=input() if j==.. 2020. 8. 10. Codeforces Round #662 (Div. 2) ABC from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): n=int(input()) print(1+n//2) A - Rainbow Dash, Fluttershy and Chess Coloring 직접 시뮬레이션 해 보면 1 - 2 - 2 - 3 - 3 - 4 - 4 - ... 순으로 답이 됨을 알 수 있다. #include #include #include #include #include using namespace std; int n, q; map plank; char oper; int target; int main() { ios::sync_with_stdio(0); cin.tie(0);.. 2020. 8. 8. Codeforces Round #660 (Div. 2) AB from sys import stdin T=int(stdin.readline()) for _ in range(T): n=int(stdin.readline()) if n 2020. 8. 6. 이전 1 2 3 다음