본문 바로가기

CodeForces17

Educational Codeforces Round 92 (Rated for Div. 2) A from sys import stdin from math import gcd def lcm(a, b): return a * b / gcd(a, b) T=int(stdin.readline()) for _ in range(T): l,r=map(int,stdin.readline().split()) if l==1: print(1,2) else: if lcm(l,int(l*(1.5))) 2020. 8. 6.
Codeforces Round #658 (Div. 2) AB from sys import stdin T=int(stdin.readline()) A=[] B=[] for _ in range(T): n,m=map(int,stdin.readline().split()) A=list(map(int,stdin.readline().split())) B=list(map(int,stdin.readline().split())) res=list(set(A) & set(B)) if len(res)==0: print("NO") else: print("YES") print(1,res[0]) A - Common Subsequence from sys import stdin T=int(stdin.readline()) for _ in range(T): cnt=0 N=int(stdin.readli.. 2020. 8. 6.
Codeforces Round #661 (Div. 3) ABC from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): n=int(input()) s=sorted(list(map(int,input().split()))) if len(s)==1: print("YES") else: flag=True for i in range(n): if s[i]-s[i-1]>1: flag=False if flag: print("YES") else: print("NO") A - Remove Smallest from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input(.. 2020. 8. 6.
Codeforces Round #656 (Div. 3) ABC #include #include using namespace std; int T, x, y, z; int a[3]; int main() { cin.tie(NULL); cout.tie(NULL); ios::sync_with_stdio(0); cin >> T; while (T--) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); if (a[1] != a[2]) { cout a[i - 1]) slope = -1; else if (a[i] a[i - 1.. 2020. 8. 6.
Codeforces Round #653 (Div. 3) ABC #include using namespace std; int T, x, y, n; int main() { cin.tie(NULL); cout.tie(NULL); ios::sync_with_stdio(0); cin >> T; while (T--) { cin >> x >> y >> n; int k; if ((n / x) * x + y L; string s = ""; for (int i = 0; i > input; s += input; } int cnt = 0, res = 0; for (int i = 0; i < L; ++i) { if (s[i] == '(') cnt++; else { if (cnt == 0) res++; else cnt--; } } cout 2020. 8. 6.