Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { int m1 = 0, m2 = 0, mi1 = 1111, mi2 = 11111, l[7], c, d; string s[5]; for (int i = 0; i < 4; i++) { cin >> s[i]; l[i] = s[i].length() - 2; if (l[i] >= m1) { m1 = l[i]; c = i; } if (l[i] <= mi1) { mi1 = l[i]; d =...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; char maxop(int lenA, int lenB, int lenC, int lenD) { char maxoption = 'a'; if (lenC >= 2 * lenB && lenC >= 2 * lenA && lenC >= 2 * lenD) maxoption = 'C'; else if (lenB >= 2 * lenA && lenB >= 2 * lenC && lenB >= 2 * lenD) maxoption = 'B'; else if (lenA >= 2 *...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a=input() b=input() c=input() d=input() l=[[len(a)-2,'A'],[len(b)-2,'B'],[len(c)-2,'C'],[len(d)-2,'D']] l = sorted(l) tmp = 0 if l[0][0]*2 <= l[1][0] and not l[-1][0] >= l[-2][0]*2: print(l[0][1]) elif l[-1][0] >= l[-2][0]*2 and not l[0][0]*2 <= l[1][0]: print(l[-1][1]) else : print('C')
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = input() na = len(a) - 2 b = input() nb = len(b) - 2 c = input() nc = len(c) - 2 d = input() nd = len(d) - 2 a = a[2:] b = b[2:] c = c[2:] d = d[2:] al = a.lower() au = a.upper() if(al == au): na = 0 bl = b.lower() bu = b.upper() if(bl == bu): nb = 0 cl = c.lower() cu = c.upper() if(cl == cu): nc = 0 ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); try (PrintWriter out = new PrintWriter(outputStream))...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { string str[4]; long long len[4]; while (cin >> str[0]) { len[0] = str[0].length() - 2; for (int i = 1; i < 4; i++) { cin >> str[i]; len[i] = str[i].length() - 2; } bool longer, shorter; long long great = 0, greati; for ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
MC=['A', 'B', 'C', 'D'] lengths=[] for tc in xrange(4): lengths.append(len(raw_input())-2) lengths1=lengths[:] lengths.sort() if lengths[0]*2<=lengths[1] and lengths[2]*2>lengths[3]: print MC[lengths1.index(lengths[0])] elif lengths[2]*2<=lengths[3] and lengths[0]*2>lengths[1]: print MC[lengths1.index(leng...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = [len(input()[2:]), 'A'] b = [len(input()[2:]), 'B'] c = [len(input()[2:]), 'C'] d = [len(input()[2:]), 'D'] ans = None l = list(sorted([a, b, c, d])) if l[0][0] * 2 <= l[1][0] and l[2][0] * 2 > l[3][0]: ans = l[0][1] elif l[2][0] * 2 <= l[3][0] and l[0][0] * 2 > l[1][0]: ans = l[3][1] else: ans = 'C' ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; inline int getn() { register int n = 0, c = getchar(); while (c < '0' || c > '9') c = getchar(); while (c >= '0' && c <= '9') n = (n << 3) + (n << 1) + c - '0', c = getchar(); return n; } int prime[1000001]; bool ans[1000001]; vector<long long int> ans1; void seive(...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = [] for i in range(4): t = raw_input() a.append(t) arr = [] for i in range(4): arr.append(((len(a[i])-2),i)) arr.sort() #print arr mif, mxf = 1,1 for i in range(1,4): if arr[i][0] < 2*arr[0][0]: mif = 0 for i in range(0,3): if 2*arr[i][0] > arr[3][0]: mxf = 0 def pr(i): #prin...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; const int N = 10000; string v[5]; string ans = "ABCD"; int main() { for (int i = 0; i < 4; i++) { getline(cin, v[i]); v[i].erase(0, 2); } vector<int> v1; for (int i = 0; i < 4; i++) { bool flag = true; for (int j = 0; j < 4; j++) { if (i != j) ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.BufferedInputStream; import java.util.Scanner; /** * Created by jizhe on 2015/12/18. */ public class TheChildAndHomework { public static void main(String[] args) { Scanner in = new Scanner(new BufferedInputStream(System.in)); int[] ls = new int[4]; int max = Integer.MIN_VA...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.Scanner; public class Main { public static void main(String[] args) { String st[] = new String[4]; int i,k = 0,flag,t = 0; int A[] = new int[4]; boolean B[] = new boolean[4]; Scanner s = new Scanner(System.in); for(i = 0;i < 4;i++){ ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
def main(): a = raw_input() b = raw_input() c = raw_input() d = raw_input() la = len(a) - 2 lb = len(b) - 2 lc = len(c) - 2 ld = len(d) - 2 lst = [(la, 'A'), (lb, 'B'), (lc,'C'), (ld,'D')] lst.sort() ans = 'C' ans1 = '' ans2 = '' if lst[0][0]*2 <= lst[1][0]: ans1 = lst[0][1] if lst[3][0] >= lst[2][0]*...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
from math import * from random import * a=[] for i in range(4): a.append(input()[2:]) ''' for i in range(4): print(a[i],len(a[i])) ''' g=[] for i in range(4): flag=1 flag1=1 for j in range(4): flag=flag and (i==j or len(a[i])>=2*len(a[j])) flag1=flag1 and (i==j or len(a[i])*2<=len(a[j])) if (flag or flag1): ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = str(input()) b = str(input()) c = str(input()) d = str(input()) first = len(a) second = len(b) third = len(c) fourth = len(d) count1 = 0 count2 = 0 count3 = 0 count4 = 0 if(first - 2 >= 2 * (second - 2)): count1 += 1 if(first - 2 >= 2 * (third - 2)): count1 += 1 if(first - 2 >= 2 * (fourth - 2)): ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; struct stu { int len, id; } a[5]; int cmp(stu x, stu y) { return x.len > y.len; } int main() { char s[150], ans[5] = "ABCD"; for (int i = 0; i <= 3; i++) { scanf("%s", s); a[i].len = strlen(s) - 2; a[i].id = i; } sort(a, a + 4, cmp); bool flag1 = fal...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = [len(raw_input())-2 for i in 'ABCD'] b = [i for i in xrange(4) if all(a[i]<=a[j]/2 for j in xrange(4) if j!=i) or all(a[i]>=a[j]*2 for j in xrange(4) if j!=i)] print 'ABCD'[b[0]] if len(b)==1 else 'C'
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
A = raw_input() B = raw_input() C = raw_input() D = raw_input() strs = [A,B,C,D] good = [] for i in xrange(4): bad = False for j in xrange(4): if i != j: if 2 * (len(strs[i]) - 2) > len(strs[j]) - 2: bad = True break if not bad: good.append(i) for i in xrange(4): bad = False f...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2, s3, s4; cin >> s1 >> s2 >> s3 >> s4; int a[4] = {0, 0, 0, 0}; int l1 = s1.length() - 2; int l2 = s2.length() - 2; int l3 = s3.length() - 2; int l4 = s4.length() - 2; if (l1 >= 2 * l2 && l1 >= 2 * l3 && l1 >= 2 * l4) a[0]++; ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
answerlist=[] lengthlist=[] great=0 finallist=['A','B','C','D'] for i in range(4): answerlist.append(str(input())) lengthlist.append(len(answerlist[i])-2) lengthlist1=lengthlist[:] lengthlist.sort() if lengthlist[0]*2<=lengthlist[1]: great=1 if lengthlist[3]>=lengthlist[2]*2: if great==1: grea...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner (System.in); int A,B,C,D; A=s.next().length()-2; B=s.next().length()-2; C=s.next().length()-2; D=s.next().length()-2; int count=0; String S=""; if ((A>=B*2 && A>=C*2 && A>=D*2) || (A<=B/2 && A<=C/2 && A<=...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = sorted([(len(input()[2::]), 'ABCD'[i]) for i in range(4)]) short = a[0][0] * 2 <= a[1][0] long = a[3][0] >= a[2][0] * 2 if short and long: print('C') elif short: print(a[0][1]) elif long: print(a[3][1]) else: print('C')
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a=input() b=input() c=input() d=input() lst=[(len(a) - 2 ,"A"),(len(b) - 2,"B"),(len(c) - 2,"C"),(len(d) - 2,"D")] f1 = 0 f2 = 0 lst.sort(key=lambda x:x[0], reverse=True) if lst[0][0] >= 2 * lst[1][0]: f1 = 1 if lst[2][0] >= 2 * lst[3][0]: f2 = 1 if (f1 and f2) or (not f1 and not f2): print("C") elif f1: ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = len(input().split('.')[1]) b = len(input().split('.')[1]) c = len(input().split('.')[1]) d = len(input().split('.')[1]) arr = [a, b, c, d] one = False two = False for i in range(4): l = arr[i] c1 = c2 = 0 for j in range(4): if i != j: if l <= arr[j]//2: c1 +=1 ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.*; import java.io.*; public class Main implements Runnable { public void solve() throws IOException { String[] s = new String[4]; for(int i = 0; i < 4; i++){ String cur = nextToken(); s[i] = cur.substring(2); } ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
q, t = 0, sorted([(len(input()) - 2, i) for i in 'ABCD']) if 2 * t[0][0] <= t[1][0]: q += 1 if t[3][0] >= 2 * t[2][0]: q += 2 print(['C', t[0][1], t[3][1], 'C'][q])
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.*; public class Main { public static void main(String[] args) { Scanner cin=new Scanner(System.in); String[] xuan=new String[4]; for(int i=0;i<4;i++) xuan[i]=cin.nextLine(); StringBuilder ans=new StringBuilder(); for(int i=0;i<4;i++) { int goal=xuan[i].length()-2; int flag1=0,fl...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Tas...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const double pi = acos(-1.0); pair<int, char> a[4]; int main() { for (int i = 0; i < 4; ++i) { string second; cin >> second; a[i] = make_pair(int((second).size()) - 2, char('A' + i)); } sort(a, a + 4); if (a[3].first >= a[2].firs...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
//package ff; import java.util.Scanner; public class prba { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // int n = sc.nextInt(); String[] arr = new String[4]; boolean q = true; String out = ""; for (int i = 0; i < 4; i++) arr[i] = sc.next(); for (int i = 0; i < 4; i...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; char question[4][100]; int len[4]; int main() { for (int i = 0; i < 4; i++) { cin >> question[i]; string s = question[i]; len[i] = s.size() - 2; } int count_ = 0; int index = -1; for (int i = 0; i < 4; i++) { int n; n = len[0]; len[0] = len...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Ma...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.*; public class Main { public static void main(String[] args) { Scanner cin=new Scanner(System.in); String[] xuan=new String[4]; for(int i=0;i<4;i++) xuan[i]=cin.nextLine(); StringBuilder ans=new StringBuilder(); for(int...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { string a, b, c, d; bool has_min = false, has_max = false; int arr[4], a1, b1, c1, d1; cin >> a >> b >> c >> d; arr[0] = a.size() - 2; arr[1] = b.size() - 2; arr[2] = c.size() - 2; arr[3] = d.size() - 2; a1 = arr[0]; b1 = arr[1]; c1 = arr[2...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; long long int solve() { string a, b, c, d; cin >> a >> b >> c >> d; long long int l[4]; l[0] = a.size() - 2; l[1] = b.size() - 2; l[2] = c.size() - 2; l[3] = d.size() - 2; long long int f = 0; char s; if ((2 * l[0] <= l[1] && 2 * l[0] <= l[2] && 2 * l[0]...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
p=[] for i in range(4): p.append(len(str(input("")))) l={"A":(p[0])-2,"B":(p[1])-2,"C":(p[2])-2,"D":(p[3])-2} p=sorted(l.items() , key= lambda x:x[1]) if(2*p[0][1]<=p[1][1] and p[-1][1]>=p[-2][1]*2): print("C") elif(2*p[0][1]<=p[1][1]): print(p[0][0]) elif(p[-1][1]>=p[-2][1]*2): print(p[-1][0]) else: ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; char c[5] = {'5', 'A', 'B', 'C', 'D'}; int main() { string str[5]; while (cin >> str[1] >> str[2] >> str[3] >> str[4]) { int cnt = 0; int ans; for (int i = 1; i <= 4; ++i) { int flag = 1; for (int j = 1; j <= 4; ++j) { if (i == j) continu...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; vector<pair<int, char> > yara; string x; bool WE, LOVE = false; int main() { for (int i = 0; i < 4; i++) { cin >> x; yara.push_back(make_pair(x.size() - 2, x[0])); } sort(yara.begin(), yara.end()); if (2 * yara[0].first <= yara[1].first) { WE = true; }...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); vector<string> A(4); for (int i = 0; i < 4; i++) { cin >> A[i]; A[i] = A[i].substr(2); } vector<int> B; for (int i = 0; i < 4; i++) { bool flag1 = true, flag2 = true; for (int j = 0; j < 4; j++)...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
def main(): CHOICES = ['A', 'B', 'C', 'D'] lines = [] for i in range(4): lines.append(raw_input()) lengths = [] for line in lines: lengths.append(len(line) - 2) greatChoices = [] for i in range(len(lines)): condition1 = True condition2 = True fo...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
A = input() B = input() C = input() D = input() arr1 = [A,B,C,D] arr = [] k=1 w=0 arr.append(len(A)-2) arr.append(len(B)-2) arr.append(len(C)-2) arr.append(len(D)-2) for i in range(4): a=0 b=0 for j in range(4): if i!=j and arr[i]<=int(arr[j]/2): a=a+1 if i!=j and arr[i]>=2*arr[j]: b = b+1 if(a==3 or b==3...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
s1=raw_input().split('.') s2=raw_input().split('.') s3=raw_input().split('.') s4=raw_input().split('.') l1=len(s1[1]) l2=len(s2[1]) l3=len(s3[1]) l4=len(s4[1]) c=[] if l1>=l2*2 and l1>=l3*2 and l1>=l4*2 or l1<=l2/2 and l1<=l3/2 and l1<=l4/2: c.append('A') if l2>=l1*2 and l2>=l3*2 and l2>=l4*2 or l2<=l1/2 and l2<=l3...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#!/usr/bin/env python def pri(i): if i == 0: print "A" if i == 1: print "B" if i == 2: print "C" if i == 3: print "D" if __name__ == "__main__": lA = raw_input() lB = raw_input() lC = raw_input() lD = raw_input() a = [len(lA.split(".")[1]), len(lB.split(".")[1]), len(lC.split(".")[1]), len(lD.split...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
ans=[] for i in range (4): ans.append(raw_input().split('.')) great=[] a,b,c,d=len(ans[0][1]),len(ans[1][1]),len(ans[2][1]),len(ans[3][1]) if 2*a<=min(b,c,d) or a>=2*max(b,c,d): great.append('A') if 2*b<=min(a,c,d) or b>=2*max(a,c,d): great.append('B') if 2*c<=min(b,a,d) or c>=2*max(b,a,d): great.a...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = raw_input() b = raw_input() c = raw_input() d = raw_input() l = [len(a)-2,len(b)-2,len(c)-2,len(d)-2] dic={'A':l[0],'B':l[1],'C':l[2],'D':l[3]} l = sorted(l) big=0 small=0 count=0 #print l if l[3]>=l[2]*2: count+=1 big=1 if 2*l[0]<=l[1]: count+=1 small=1 if count==1: if big==1: print max...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import itertools import sys from collections import defaultdict, Counter from math import sqrt input = sys.stdin.readline ############ ---- Input Functions ---- ############ def inp(): return (int(input())) def inlt(): return (list(map(int, input().split()))) def insr(): s = input() return (list(...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
def STR(): return list(input()) def INT(): return int(input()) def MAP(): return map(int, input().split()) def MAP2():return map(float,input().split()) def LIST(): return list(map(int, input().split())) def STRING(): return input() import string import sys from heapq import heappop , heappush from bisect import * from...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; struct predicate { bool operator()(const pair<char, int> &left, const pair<char, int> &right) { return left.second < right.second; } }; int main() { string s1, s2, s3, s4; vector<pair<char, int>> v; bool x = false; double size1, size2, size3, size4, res0, re...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; string a, b, c, d; int len[5], ans; bool check(int x) { int flag1 = 1, flag2 = 1; for (int i = 1; i <= 4; i++) if (i != x && len[x] < len[i] * 2) flag1 = 0; for (int i = 1; i <= 4; i++) if (i != x && len[x] > len[i] / 2) flag2 = 0; return flag1 | flag2; } in...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = sorted([(len(input())-2,i) for i in 'ABCD']) g = "" if a[0][0]*2 <= a[1][0]: g += a[0][1] if a[3][0] >= 2 * a[2][0]: g += a[3][1] if len(g) == 1: print(g) else : print("C")
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.*; import java.util.*; import java.math.*; public class p437a { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[4]; int[] b = new int[4]; String[] str = new String[4]; int check = -1; for (int i = 0; i < ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
def main(): l = [] c = [] for i in range(4): l.append(input()[2:]) c.append(len(l[-1])) g = [False] * 4 for i in range(4): longer = 0 shorter = 0 for j in range(4): if i == j: continue if c[i] <= c[j] // 2: ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputReader reader = new InputReader(System.in); PrintWriter writer = new PrintWriter(System.out, true); try { Task task = new Task(); task.solve(reader, ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; string ss[] = {"A", "B", "C", "D"}; int main() { ios_base::sync_with_stdio(0); string s[4]; cin >> s[0]; cin >> s[1]; cin >> s[2]; cin >> s[3]; int a[4]; int b[4]; a[0] = s[0].length() - 2; a[1] = s[1].length() - 2; a[2] = s[2].length() - 2; a[3] = s...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
''' Created on 2016年3月4日 @author: HaoGe ''' choise=[] for i in range(4): ci=input() choise.append( [ len(ci)-2, ci[0] ] ) choise.sort() if 2*choise[0][0]<=choise[1][0] and choise[3][0]<2*choise[2][0]: print(choise[0][1]) elif choise[3][0]>=2*choise[2][0] and 2*choise[0][0]>choise[1][0]: print(choise[3]...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import operator def main(): h = {} for x in range(4): input = raw_input() h[input] = len(input.split('.')[1]) sort = sorted(h.iteritems(), key=operator.itemgetter(1)) count = 0 ans = None if sort[0][1]*2 <= sort[1][1]: count += 1 ans = sort[0][0].split('.')[0] ...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
def main(): l = [] for _ in range(4): n, s = input().split('.') l.append((len(s), n)) a, b, c, d = sorted(l) res = ['C'] if a[0] * 2 <= b[0]: res.append(a[1]) if c[0] * 2 <= d[0]: res.append(d[1]) print(res[(len(res) - 1) & 1]) if __name__ == '__main__': ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
s = [] length = [0 for i in range(4)] for i in range(4): s.append(input()[2:]) length[i] = len(s[i]) var = [] for i in range(4): if length[i] >= 2*max(length[:i] + length[i+1:]) or \ length[i] <= min(length[:i] + length[i+1:])//2: var.append(i) if len(var) == 1: print(chr(ord('A') + var...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
Q = [("A", raw_input()[2:]), ("B", raw_input()[2:]), ("C", raw_input()[2:]), ("D", raw_input()[2:])] nQ = [n[1] for n in Q] great = [] for id, n in Q: ln = len(n) for _, z in Q: if z != n: # Twice shorter if len(z) / ln >= 2: pass else: ...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
l1=list(str(input())) l2=list(str(input())) l3=list(str(input())) l4=list(str(input())) c=[] if (len(l1)-2>=(2*(len(l2)-2)) and len(l1)-2>=(2*(len(l3)-2)) and len(l1)-2>=(2*(len(l4)-2))) or (len(l2)-2>=(2*(len(l1)-2)) and len(l3)-2>=(2*(len(l1)-2)) and len(l4)-2>=(2*(len(l1)-2))): c.append(1) else: c.append(0) ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws NumberFormatException,IOException { Stdin in = new Stdin(); Prin...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
lis=[] for i in range(4): lis.append(len(input())-2) pos=[] if (lis[1]//lis[0]>=2 and lis[2]//lis[0]>=2 and lis[3]//lis[0]>=2) or \ (lis[0]//lis[1]>=2 and lis[0]//lis[2]>=2 and lis[0]//lis[3]>=2): pos.append('A') if (lis[0]//lis[1]>=2 and lis[2]//lis[1]>=2 and lis[3]//lis[1]>=2) or \ (lis[1]//lis[0]>=2 an...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; bool compare(pair<string, long long> p, pair<string, long long> q) { return p.second > q.second; } bool mcompare(pair<string, long long> p, pair<string, long long> q) { return p.second < q.second; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; char r(int x) { if (x == 0) return 'A'; else if (x == 1) return 'B'; else if (x == 2) return 'C'; else return 'D'; return ' '; } int main() { vector<string> all(4); int min, max; int maxp = 0; int minp = 0; for (int i = 0; i < 4; i++) { ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7, MAX = 1e18; struct wins { int st; int en; }; bool prime[1000001]; void Sieve(int n) { n = 1000000; memset(prime, true, sizeof(prime)); for (int p = 2; p * p <= n; p++) { if (prime[p] == true) { for (int i = p * p; i <= n; i += p)...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class CF437A { public static void main(String[] args) { FastReader input = new FastReader(); PrintWriter pw =...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
'''input A._ B.__ C.____ D.________ ''' i = sorted(enumerate([len(input()) - 2 for _ in range(4)]), key=lambda x: x[1]) a, b = False, False if all(2*i[0][1] <= i[x][1] for x in range(1, 4)): a = True if all(i[3][1] >= 2*i[y][1] for y in range(3)): b = True if a == b: print("C") elif a == True: print("ABCD"[i[0][0]]...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; string ss[200]; int main() { pair<int, char> p[200]; for (int i = 1; i <= 4; i++) { cin >> ss[i]; p[i].first = ss[i].size() - 2; p[i].second = char(i + 64); } sort(p + 1, p + 5); if (p[1].first * 2 <= p[2].first && p[3].first * 2 > p[4].first) cout...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { string s; char mi, ma; int max = 0, min = INT_MAX; pair<int, char> p[4]; for (int i = 0; i < 4; ++i) { cin >> s; p[i].first = s.length() - 2; p[i].second = s[0]; } sort(p, p + 4); int flag1 = 0, flag2 = 0; for (int j = 1; j < 4; ++...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
if __name__ == '__main__': lines = list() for i in range(4): lines.append([len(str(input())) - 2, i]) lines.sort(key=lambda x: x[0]) values = list() if lines[0][0] * 2 <= lines[1][0]: values.append(lines[0][1]) if lines[2][0] * 2 <= lines[3][0]: values.append(lines[3][1])...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.Scanner; public class TheChildAndHomework { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String temp; int[] v = new int[4]; int[] d = new int[4]; int[] r = new int[4]; for (int i = 0; i < 4; i++) { temp = scan.nextLine(); v[i] = temp.length() - 2; ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import sys if __name__ == '__main__': a = len(sys.stdin.readline().strip()[2:]) b = len(sys.stdin.readline().strip()[2:]) c = len(sys.stdin.readline().strip()[2:]) d = len(sys.stdin.readline().strip()[2:]) data = [(a, 'A'),(b, 'B'),(c, 'C'),(d, 'D')] data.sort(key=lambda x:x[0]) start = dat...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
# python 3 """ """ from operator import itemgetter def the_child_and_homework(answers_list: list) -> str: answers_list.sort(key=itemgetter(1)) # print(answers_list) min_len = answers_list[0][1] choice = "" choices = "" if min_len == answers_list[1][1]: choice = "C" else: if...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = [] k = 0 for i in range(4): a.append(str(input())[2:]) for i in range(4): shorter, longer = True, True for j in range(4): if i != j: if len(a[i]) * 2 > len(a[j]): shorter = False if len(a[j]) * 2 > len(a[i]): longer = False if longer or...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { char s[5][110]; int len[5], mark, i, j, num, temp, k; int c[5] = {0}; for (i = 1; i <= 4; i++) gets(s[i]); for (i = 1; i <= 4; i++) len[i] = strlen(s[i]) - 2; num = 0; for (i = 1; i <= 4; i++) { temp = 0; for (j = 1; j <= 4; j++) if ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
choice = ['A', 'B', 'C', 'D'] size = [] min_, max_, great, index = float("inf"), float("-inf"), 0, 0 for i in range(4): ch = input()[2:] size.append((len(ch), i+1)) min_, max_ = min(len(ch), min_), max(len(ch), max_) size.sort() if min_ <= size[1][0]//2: great += 1 index = size[0][1] if max_ >= size...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
k = lambda x: len(x)-2 c = sorted([raw_input() for i in range(4)], key=k) l = map(k,c) f,g = 2*l[0] <= l[1], 2*l[2] <= l[3] if f and not g: print c[0][0] elif g and not f: print c[3][0] else: print 'C'
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
# http://codeforces.com/problemset/problem/437/A def getIndex(n): if n == 0: return "A" elif n == 1: return "B" elif n == 2: return "C" else: return "D" inp = [] for i in range(4): a = input() inp += [a.split(".")[1]] li = [] for x in inp: li += [len(x)] sho...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
from operator import itemgetter list = {} list['A'] =len(raw_input(""))-2 list['B'] =len(raw_input(""))-2 list['C'] =len(raw_input(""))-2 list['D'] =len(raw_input(""))-2 v=sorted(list.values()) if v[3]/v[2] >= 2 : if v[1]/v[0] >= 2 : print 'C' else : for i in list : if lis...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; string s[4]; bool so(int idx) { bool k1 = 1, k2 = 1; for (int i = 0; i < 4; i++) if (i != idx) k1 &= (s[idx].size() - 2) >= 2 * (s[i].size() - 2), k2 &= 2 * (s[idx].size() - 2) <= (s[i].size() - 2); return k1 || k2; } int main() { int n = 4; fo...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2, s3, s4; cin >> s1 >> s2 >> s3 >> s4; vector<pair<int, char> > a(4); a[0].first = s1.size() - 2; a[0].second = 'A'; a[1].first = s2.size() - 2; a[1].second = 'B'; a[2].first = s3.size() - 2; a[2].second = 'C'; a[3].first = s4.s...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
str1 = raw_input() str2 = raw_input() str3 = raw_input() str4 = raw_input() l = [str1[2::],str2[2::],str3[2::],str4[2::]] l2 = [str1,str2,str3,str4] m = 0 n = 1000 saida1 = "" saida2 = "" for i in range(4): if len(l[i]) > m: m = len(l[i]) saida1 = l2[i] if len(l[i]) < n: n = len(l[i]) ...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.*; public class C437 { public static void main(String[] args) { Scanner sc= new Scanner(System.in); String s1=sc.next(); String s2=sc.next(); String s3=sc.next(); String s4=sc.next(); int len1=s1.length()-2; int len2=s2.length()-2; i...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.ArrayList; import java.util.Scanner; public class T437A { public String solve(String[] a) { int[] l = new int[4]; for (int i = 0; i < 4; i ++) l[i] = a[i].length() - 2; ArrayList<Integer> ans = new ArrayList<Integer>(); for (int i = 0; i < 4; i ++) { boolean f1 = true; boolean f2 =...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; import java.util.StringTokenizer; /** * Created with IntelliJ IDEA. * User: AUtemuratov * Date: 07.04.14 * Time: 15:43 * To change this template use File | Settings | ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; char st[4][150] = {0}; int main() { int minn = 100000000, maxx = 0, bj1 = 0, bj2 = 0, i, j, k, l, s, t, k1 = 0, k2 = 0, result = -1; int a[4]; for (i = 0; i <= 3; i++) { gets(st[i]); a[i] = strlen(st[i]) - 2; if (minn > a[i]) minn = a[i], k1 = i; ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = len((raw_input()))-2 b = len((raw_input()))-2 c = len((raw_input()))-2 d = len((raw_input()))-2 l = [] for i in xrange(102): l.append(0) l[a]+=1 l[b]+=1 l[c]+=1 l[d]+=1 ans = [] ch = 0 if ch: print "C" else: if (a <= b/2 and a <= c/2 and a <= d/2) or (a >= 2*b and a >= c*2 and a >= d*2): ans.ap...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
variants = [len(input()[2:]) for i in range(4)] is_awesome = [1]*4 for i in range(4): for j in range(4): if i != j and (not variants[i] * 2 <= variants[j]): is_awesome[i] = 0 if not is_awesome[i]: is_awesome[i] = 1 for j in range(4): if i != j and (not variants[i]...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:512000000") using namespace std; template <class telem> telem MAX(telem a, telem b) { return (a > b) ? a : b; } template <class telem> telem MIN(telem a, telem b) { return (a < b) ? a : b; } template <class telem> telem GCD(telem a, telem b) { return b ? GC...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = raw_input() b = raw_input() c = raw_input() d = raw_input() a_length = len(a) - 2 b_length = len(b) - 2 c_length = len(c) - 2 d_length = len(d) - 2 tuple_a = (a_length,a[2:], 'A') tuple_b = (b_length, b[2:], 'B') tuple_c = (c_length, c[2:], 'C') tuple_d = (d_length, d[2:], 'D') tuples = [tuple_a, tuple_b, tuple_...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; const int MOD = 1e9 + 7; const int INF32 = 1 << 30; const long long INF64 = 1LL << 60; void solve() { string A, B, C, D; cin >> A >> B >> C >...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { char s[4][105]; int len[4], i, j, c = 0, ans; bool greatest = 1, least = 1; for (i = 0; i < 4; i++) { cin >> s[i]; len[i] = strlen(s[i]) - 2; } for (i = 0; i < 4; i++) { greatest = 1; least = 1; for (j = 0; j < 4; j++) { if...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
__author__ = 'asmn' import sys #sys.stdin = open('in') description = [chr(i + ord('A')) + input().strip()[3:] for i in range(4)] description.sort(key=lambda s: len(s)) long_exist = (len(description[3]) >= len(description[2]) * 2) short_exist = (len(description[0]) * 2 <= len(description[1])) if long_exist and not s...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.*; public class Main { public static void main(String[] args){ solve(); return; } static void solve(){ Scanner scn = new Scanner(System.in); String[] d = new String[4]; int[] l = new int[4]; for(int i=0;i<4;i++){ d[i] = scn.nextLine(); l[i] = d[i].length()-2; } int lcount=0; ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
s1=input() s2=input() s3=input() s4=input() l1=len(s1)-2 l2=len(s2)-2 l3=len(s3)-2 l4=len(s4)-2 ll=[[l1,"A"],[l2,"B"],[l3,"C"],[l4,"D"]] ll.sort() if(ll[0][0]<=ll[1][0]/2 and ll[-1][0]>=ll[-2][0]*2): print("C") elif(ll[0][0]<=ll[1][0]/2): print(ll[0][1]) elif(ll[-1][0]>=ll[-2][0]*2): print(ll[-1][1]) else: ...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s; ArrayList<Node> size = new ArrayList<Node>(); for (int i = 0; i < 4; i++) { s = in.next(); ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.Scanner; public class JavaApplication2 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s=sc.nextLine(); String a=s.substring(2,s.length()); s=sc.nextLine(); String b=s.substring(2,s.length()); s=sc.nextLine(); ...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.*; import java.util.ArrayList; import java.util.List; public class Task437A { public static void main(String... args) throws NumberFormatException, IOException { Solution.main(System.in, System.out); } static class Scanner { private final BufferedReader br; ...
JAVA