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
import java.util.Scanner; public class PA { public static void main(String[] args){ Scanner in = new Scanner(System.in); int[] l = new int[4]; for(int i=0;i<4;i++) l[i] = in.next().length()-2; int special = 0; int longans = -1; int shortans = -1; for(int i=0;i<4;i++){ int len = l[i]; fo...
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
questionNames = ['A', 'B', 'C', 'D'] lengths = [(len(input()) - 2, questionNames[i]) for i in range(4)] lengths.sort() firstIsGreat = (lengths[0][0] <= lengths[1][0] // 2) lastIsGreat = (lengths[3][0] >= lengths[2][0] * 2) if firstIsGreat ^ lastIsGreat: if firstIsGreat: print(lengths[0][1]) else: print(lengths...
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
answer = [ ] for i in xrange(4): k = raw_input() answer.append([len(k)-2,k]) answer = sorted(answer) great_choice = 0 great = [] if answer[1][0] / answer[0][0] >= 2: great.append(answer[0][1][0]) if answer[3][0] / answer[2][0] >= 2: great.append(answer[3][1][0]) if len(great) == 1: print great[0] el...
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 strA, strB, strC, strD; vector<pair<int, char> > v; vector<char> v1, v2; cin >> strA >> strB >> strC >> strD; v.push_back(make_pair(strA.length() - 2, 'A')); v.push_back(make_pair(strB.length() - 2, 'B')); v.push_back(make_pair(strC.length(...
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() a = len(A[A.find('.')+1:]) B = input() b = len(B[B.find('.')+1:]) C = input() c = len(C[C.find('.')+1:]) D = input() d = len(D[D.find('.')+1:]) ans = "C" g = 0 h = 0 #print(a,b,c,d) if(a>=2*b and a>=2*c and a>=2*d): ans = "A" g+=1 elif(b>=2*a and b>=2*c and b>=2*d): ans = "B" g+=1 elif(c>=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
MC=['A', 'B', 'C', 'D'] lengths=[] for t in range(4): lengths.append(len(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(lengths[...
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 great(int w, int x, int y, int z) { return ((w >= x * 2 && w >= y * 2 && w >= z * 2) || (w <= x / 2 && w <= y / 2 && w <= z / 2)); } int main() { int ai, bi, ci, di; string tes; getline(cin, tes); ai = tes.length() - 2; getline(cin, tes); bi = t...
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[5]; for (int i = 0; i < 4; i++) cin >> s[i]; int t = 0; char c; for (int i = 0; i < 4; i++) { bool flag = false, flag2 = false; for (int j = 0; j < 4; j++) if (i != j) { if ((s[i].length() - 2) * 2 > (s[j].length() - 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 = [] for i in range(4): cur = input() a.append((len(cur) - 2, cur[0])) a.sort() gs = a[0][0] * 2 <= a[1][0] gl = a[3][0] >= a[2][0] * 2 if (gs and gl) or (not gs and not gl): print('C') else: print(a[0][1] if gs else a[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
#include <bits/stdc++.h> using namespace std; int main() { string tmp; int a[5], s[5], b[5]; for (int i = 1; i <= 4; i++) { cin >> tmp; a[i] = tmp.length() - 2; s[i] = 0; b[i] = 0; } int cB = 0; int cS = 0; if (a[4] / a[1] >= 2 && a[3] / a[1] >= 2 && a[2] / a[1] >= 2) { cS++; s[1] ...
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; void Shivam() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int32_t main() { Shivam(); map<long long, char> mp; string s; long long x[4], c1 = 0, c2 = 0; long long i; cin >> s; x[0] = s.size() - 2, mp[x[0]] = 'A'; cin >> s; x[1] = s.size...
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(input().split('.')[1]), 'A') B = (len(input().split('.')[1]), 'B') C = (len(input().split('.')[1]), 'C') D = (len(input().split('.')[1]), 'D') tab = sorted([A, B, C, D]) if tab[0][0] * 2 <= tab[1][0] and tab[-1][0] < tab[-2][0] * 2: print(tab[0][1]) elif tab[-1][0] >= tab[-2][0] * 2 and tab[0][0] * 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; char s[105]; int a, b, c, d; char get(int x) { if (x == a) return 'A'; if (x == b) return 'B'; if (x == c) return 'C'; return 'D'; } int main() { cin >> s; a = strlen(s); cin >> s; b = strlen(s); cin >> s; c = strlen(s); cin >> s; d = strlen(s); a ...
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
arr = sorted([(len(input())-2,i) for i in 'ABCD']) p=0 if 2 * arr[0][0] <= arr[1][0]: p+=1 if 2 * arr[-2][0] <= arr[-1][0]: p+=2 print(['C',arr[0][1],arr[-1][1],'C'][p])
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 = raw_input() a = a.split(".") b = raw_input() b = b.split(".") c = raw_input() c = c.split(".") d = raw_input() d = d.split(".") arr = [[len(a[1]), 'A'], [len(b[1]), 'B'], [len(c[1]), 'C'], [len(d[1]), 'D']] arr.sort() if arr[0][0]*2<=arr[1][0] and arr[2][0]*2<=arr[3][0]: print 'C' elif arr[0][0]*2<=arr[1][...
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.*; import java.io.*; public class main { static FastScanner sc; static PrintWriter pw; public static void main(String[] args) { // Scanner sc = new Scanner(System.in); sc = new FastScanner(); pw = new PrintWriter(System.out); // int t = sc.ni(); // while(t-->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
#include <bits/stdc++.h> using namespace std; ifstream fin("T.txt"); int main(int argc, char *argv[]) { string a; int x[4]; for (int i = 0; i < 4; i++) { cin >> a; x[i] = a.size() - 2; } int max = 0, min = 0, l, f; for (int i = 0; i < 4; i++) { int t = 0, k = 0; 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
#include <bits/stdc++.h> int main() { char a[102]; scanf("%s", a); int l1, l2, l3, l4; l1 = strlen(a) - 2; scanf("%s", a); l2 = strlen(a) - 2; scanf("%s", a); l3 = strlen(a) - 2; scanf("%s", a); l4 = strlen(a) - 2; int f = 0, f1 = 0, f2 = 0, f3 = 0, f4 = 0; if ((l1 >= (2 * l2) && l1 >= (2 * l3) ...
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; bool check[4]; long long cnt[4]; int main() { string A, B, C, D; cin >> A >> B >> C >> D; cnt[0] = A.length() - 2; cnt[1] = B.length() - 2; cnt[2] = C.length() - 2; cnt[3] = D.length() - 2; for (long long i = 0; i < 4; i++) { check[i] = false; } if ((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> int check(int m[], int n[], int o[], int p[]) { if ((m[0] <= n[0] / 2) && (m[0] <= o[0] / 2) && (m[0] <= p[0] / 2)) m[1] = 1; if ((m[0] >= n[0] * 2) && (m[0] >= o[0] * 2) && (m[0] >= p[0] * 2)) m[2] = 1; return m[1] + m[2]; } using namespace std; int main() { string a, b, c, d; cin >>...
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() { int gc = 0; char large, small; string a, b, c, d; getline(cin, a); getline(cin, b); getline(cin, c); getline(cin, d); int la = a.size() - 2, lb = b.size() - 2, lc = c.size() - 2, ld = d.size() - 2; int s[4] = {la, lb, lc, ld}; sort(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
a = len(input()[2:]) b = len(input()[2:]) c = len(input()[2:]) d = len(input()[2:]) cnt, res = 0, 'C' if 2 * a <= min(b, c, d) or a >= 2 * max(b, c, d): cnt += 1 ; res = 'A' if 2 * b <= min(a, c, d) or b >= 2 * max(a, c, d): cnt += 1 ; res = 'B' if 2 * c <= min(a, b, d) or c >= 2 * max(a, b, d): cnt += 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 os sa=input() sa=len(sa)-2 sb=input() sb=len(sb)-2 sc=input() sc=len(sc)-2 sd=input() sd=len(sd)-2 arr=[sa,sb,sc,sd] arr.sort() #print(arr) z=[] if arr[0]<=arr[1]//2 and arr[0]<=arr[2]//2 and arr[0]<=arr[3]//2: if arr[0]==sa: z.append("A") elif arr[0]==sb: z.append("B") elif arr[0]==sc: z.append("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
lll = 0 aa =0 bb = 0 cc = 0 dd = 0 flag = 0 a = raw_input() b = raw_input() c = raw_input() d = raw_input() for t in a: aa = aa + 1 for t2 in b: bb = bb + 1 for t3 in c: cc = cc + 1 for t4 in d: dd = dd + 1 if aa-2 >= ((bb-2)*2) and aa-2 >= ((cc-2)*2) and aa-2 >= ((dd-2) * 2): lll = lll + 1 ...
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> int lnum[4], snum[4], ynum[4]; int main(void) { int i, l, j, number = 0, b = 0, m = 0, n = 0; char num[10000]; for (i = 0; i < 4; i++) { scanf("%s", num); l = strlen(num); l -= 2; ynum[i] = l; lnum[i] = 2 * l; snum[i] = l / 2; } for (i = 0; i < 4; i++) { m ...
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 A[1000], B[1000], C[1000], D[1000]; cin >> A >> B >> C >> D; int l1 = strlen(A) - 2; int l2 = strlen(B) - 2; int l3 = strlen(C) - 2; int l4 = strlen(D) - 2; bool flag = true; int cnt = 0; char ans; if (2 * l1 <= l2 && 2 * l1 <= l3 && 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
import java.util.*; public class main{ public static void main(String[] args){ Scanner in = new Scanner(System.in);//(System.in) ArrayList<String> choices = new ArrayList<String>(); while(in.hasNextLine()){ choices.add(in.nextLine().split("\\.")[1].trim()); } int winner = -1; for(int i=0;i<choices.size()...
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.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Map; import java.util.TreeMap; public class Ja{ public static void main (String []args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamRead...
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
# coding: utf-8 choice = [input() for i in range(4)] choice = sorted([[len(choice[i][2:]),choice[i][2:],choice[i][0]] for i in range(4)]) ans = [] if choice[0][0]*2<=choice[1][0] and choice[0][0]*2<=choice[2][0] and choice[0][0]*2<=choice[3][0]: ans.append(choice[0][2]) if choice[3][0]>=choice[0][0]*2 and choic...
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 a[10]; int main() { int b = 0, c = 0, i; vector<int> a(4); string s[4]; for (i = 0; i < 4; i++) { cin >> s[i]; a[i] = s[i].length(); a[i] = a[i] - 2; } sort(a.begin(), a.end()); if ((2 * a[0]) <= a[1]) b++; if ((2 * a[2]) <= a[3]) c++; 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
a=input()[2:] b=input()[2:] c=input()[2:] d=input()[2:] di={} di[a]='A' di[b]='B' di[c]='C' di[d]='D' l=[a, b, c, d] l.sort(key=lambda x : len(x)) good1, good2=0, 0 if 2*len(l[0])<=len(l[1]) : good1+=1 if len(l[3])>=2*len(l[2]) : good2+=1 if good1>0 and good2>0: print('C') elif good1 and not good2: print(di[l[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; int main() { char option[4][105], ans; int i, min1, max1, min2, max2, minlen, maxlen, length[4], flag = 0; for (i = 0; i < 4; i++) { cin >> option[i]; length[i] = strlen(option[i]) - 2; } minlen = length[0]; min1 = 0; maxlen = length[0]; max1 = 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
#include <bits/stdc++.h> using namespace std; char s[111][111]; int main() { int i, j, sz[111], cnt = 0, ans = -1; for (i = 0; i < 4; i++) { scanf("%s", s[i]); sz[i] = strlen(s[i]) - 2; } for (i = 0; i < 4; i++) { int c1 = 0, c2 = 0; for (j = 0; j < 4; j++) if (i != j) { if (2 * sz...
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(input())-2 b = len(input())-2 c = len(input())-2 d = len(input())-2 l = list() l.append(a) l.append(b) l.append(c) l.append(d) l = sorted(l) one, two = 0, 0 if l[0] <= l[1]//2 and l[0] <= l[2]//2 and l[0] <= l[3]//2: one = 1 if l[3] >= l[0]*2 and l[3] >= l[1]*2 and l[3] >= l[2]*2: two = 1 if one+two == ...
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
p={ __:len(input())-2 for __ in 'ABCD'} from math import floor #print(p) las=None tot=0 for i in p: if all([(2*p[i])<=p[j] for j in p if i!=j]) or\ all([p[i]>=(p[j]*2) for j in p if i!=j]): las=i tot+=1 if las!=None and tot==1: print(las) 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.Scanner; import java.util.Arrays; import java.util.Collections; import java.lang.Math; import java.util.ArrayList; import java.util.*; import java.math.*; public class childhw{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.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
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, p; char ch, s[200]; scanf("%s", &s); a = strlen(s) - 2; scanf("%s", &s); b = strlen(s) - 2; scanf("%s", &s); c = strlen(s) - 2; scanf("%s", &s); d = strlen(s) - 2; p = 0; if ((a <= b / 2 && a <= c / 2 && a <= d / 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; const int MOD = 1e9 + 7; const int SIZE = 1e6 + 10; string s[4]; int main() { for (int i = 0; i < (4); ++i) cin >> s[i]; int d[4]; for (int i = 0; i < (4); ++i) d[i] = ((int)(s[i]).size()) - 2; vector<pair<int, int> > pp; for (int i = 0; i < (4); ++i) { pp.pus...
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.util.Arrays; public class Main { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); 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
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author xuanquang1999 */ public class Main { public static void main(Stri...
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
#!/usr/bin/env python # -*- coding: UTF-8 -*- import time import sys import io import re import math import itertools #10**9+7 mod=1000000007 #start = time.clock() a=[] for i in range(4): w=raw_input() a.append((len(w)-2,chr(i+65))) a.sort() chk=0 #一番長いのが2倍以上かチェック if a[2][0]*2<=a[3][0]: chk+=1 ans=a[3][...
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; char q[5][1000]; struct s { int data; char id; }; bool cmp(struct s a, struct s b) { return a.data > b.data; } int main() { scanf("%s %s %s %s", q[1], q[2], q[3], q[4]); struct s len[5]; len[1].data = strlen(q[1]) - 2; len[2].data = strlen(q[2]) - 2; len[3].da...
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
var inSarr = []; var minArr = [0, 0, 0, 0]; var maxArr = [0, 0, 0, 0]; for (var i=0; i<4; i++) { inSarr[i] = readline(); } for (i=0; i<4; i++) { for (var j=0; j<4; j++) { if (i!=j && inSarr[i].length-2 <= (inSarr[j].length-2)/2) { minArr[i] += 1; } if (i!=j && (inSarr[i].len...
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=len(input())-2 b=len(input())-2 c=len(input())-2 d=len(input())-2 x=[a,b,c,d] ans=[] for i in range(4): f=[] for j in range(4): if i!=j: if x[i]<(x[j]//2): f.append(1) elif x[i]>2*x[j]: f.append(2) elif x[i]==x[j]//2 or x[i]==2*x[j]: f.append(3) if len(f)==3 and (len(set(f))==1 or set(f)=={...
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; /** * Created by mosinnik * Date: 02.05.2014 Time: 19:50 */ public class ZadA { public static void main(String[] args) { // BufferedReader br = new BufferedReader(System.in); Scanner console = new Scanner(System.in); int lengthA = console.nextLine().length() - 2; int lengthB = con...
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 = input() B = input() C = input() D = input() arr[] b = len(B) - 2 c = len(C) - 2 d = len(D) - 2 #print(a) #print(b) #print(c) #print(d) ans = "C" if (a >= 2*b and a >= 2*c and a >= 2*d) or (2 * a <= b and 2 * a <= c and 2 * a <= d) : ans = 'A' elif (b >= 2*a and b >= 2*c and b >= 2*d) or (2 * b <= a and 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; int main() { string a, b, c, d; cin >> a >> b >> c >> d; int as, bs, cs, ds; as = a.size() - 2; bs = b.size() - 2; cs = c.size() - 2; ds = d.size() - 2; int ba, bb, bc, bd; ba = 0; bb = 0; bc = 0; bd = 0; if ((as >= bs * 2 && as >= cs * 2 && as >= ...
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 s[4]; bool cmp(string &a, string &b) { return a.length() > b.length(); } int main() { for (int i = 0; i < 4; i++) cin >> s[i]; sort(s, s + 4, cmp); if (s[0].length() - 2 >= 2 * s[1].length() - 4 && 2 * s[3].length() - 4 <= s[2].length() - 2) 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; struct my { int x; char ch; }; bool operator<(my ob1, my ob2) { return ob1.x < ob2.x; } int main() { my choices[4]; string s; int i; for (i = 0; i < 4; i++) { cin >> s; choices[i].x = s.size() - 2; choices[i].ch = s[0]; } sort(choices, choices + ...
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.util.*; import java.io.*; import java.math.*; public class Main { FastScanner in; PrintWriter out; public void solve() throws IOException { int[] len = new int[4], lencopy = new int[4]; for(int i = 0; i < 4; ++i) len[i] = lencopy[i] = in.next().length() - 2; Arrays.sort(len); int best...
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
n = sorted([(i, len(input()[2:])) for i in ['A', 'B', 'C', 'D']],key=lambda x: x[1]) r = 'C' if 2*n[0][1] <= n[1][1]: if 2*n[2][1] > n[3][1]: r = n[0][0] else: if 2*n[2][1] <= n[3][1]: r = n[3][0] print(r)
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 sys import math from sys import stdin, stdout # Most Frequently Used Number Theory Concepts # SOE(helper function of get gcd) def sieve(N): primeNumbers = [True]*(N+1) primeNumbers[0] = False primeNumbers[1] = False i = 2 while i*i <= N: j = i if primeNumbers[j]: ...
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 A1 { public static void main(String[] args)throws Exception{ IO.init(System.in); String[] inputs = new String[4]; for(int i=0;i<4;++i)inputs[i] = IO.next(); int[] lengths = new int[4]; for(int i=0;i<4;++i)len...
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.*; public class homework { public static void main(String[] args)throws IOException { // TODO Auto-generated method stub BufferedReader read= new BufferedReader(new InputStreamReader(System.in)); String A = read.readLine(); String B = read.readLine()...
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 solve(): choices_lengths = [len(raw_input()[2:]) for i in range(4)] choices_names = ["A","B","C","D"] max_len = max(choices_lengths) min_len = min(choices_lengths) max_count = 0 min_count = 0 case_1 = True case_2 = True for i in range(4): if choices_lengths[i] == max_len...
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 o[4]; int main() { int maxlength = 0, minlength = 110, maxindex = 0, minindex = 0; int c[4]; for (int i = 0; i < 4; i++) { getline(cin, o[i]); c[i] = o[i].length() - 2; } sort(c, c + 4); bool hasMax = c[3] >= c[2] * 2; bool hasMin = c[0] <= c[1]...
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 a[105]; char b[105]; char c[105]; char d[105]; struct node { char m; int l; }; node num[5]; bool cmp(node a, node b) { return a.l < b.l; } int main() { cin >> a; cin >> b; cin >> c; cin >> d; int A = strlen(a) - 2; int B = strlen(b) - 2; int C = strle...
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.*; import java.util.*; public class TheChildAndHomework { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); boolean half, twice; boolean[] greats, halfs, twices; int c, ind; int[] lengths; //while(in.h...
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.*; import java.io.*; public class Main437A { static PrintWriter out=new PrintWriter(System.out); public static class obj implements Comparable<obj> { String s; int len; public obj(int len,String s) { this.s=s; this.len=len; } public int compareTo(obj that) ...
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> int l[4]; void ReadData() { char str[109]; for (int i = 0; i < 4; i++) { scanf("%s%*c", str); l[i] = strlen(str) - 2; } } bool isAwesome(int idx) { int cnt = 0; for (int i = 0; i < 4; i++) { if (i != idx) { if (l[idx] * 2 <= l[i]) { cnt++; } } } ...
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
answers = [len(input().split(".")[1]) for x in range(4)] letters = ["A", "B", "C", "D"] good = [] for x in range(4): condition = True for y in range(4): if x != y and not answers[x] * 2 <= answers[y]: condition = False break if not condition: condition = True ...
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 sys, os # import numpy as np from math import sqrt, gcd, ceil, log, floor, sin, pi from math import factorial as fact from bisect import bisect, bisect_left from collections import defaultdict, Counter, deque from heapq import heapify, heappush, heappop from itertools import permutations input = sys.stdin.readli...
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 A { public static void main(String[] args) { Scanner input = new Scanner(System.in); String a = input.nextLine(); String b = input.nextLine(); String c = input.nextLine(); String d = input.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.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String[] s = new String[4]; char choice_min = 'c' ; char choice_max = 'c' ; boolean gre...
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 solve(choices,index): if index == 0: l = choices[0] if l*2 <= choices[1] and l*2 <= choices[2] and l*2 <= choices[3]: return True if l >= choices[1]*2 and l >= choices[2]*2 and l >= choices[3]*2: return True return False if index == 1: l = choices[1] if l*2 <= choices[0] and l*2 <= choices[2] ...
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
answers = ['A', 'B', 'C', 'D'] variants = [] for i in range(0, 4): variants.append((len(input()) - 2, answers[i])) asc = sorted(variants, key=lambda variant: variant[0]) des = sorted(variants, key=lambda variant: variant[0], reverse = True) good_variants = [] if (2 * asc[0][0] <= asc[1][0]): good_variants.appe...
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
v = [input()[2:] for i in range(4)] l = [(len(s),s) for s in v] min_l, min_s = min(l)[0], min(l)[1] max_l, max_s = max(l)[0], max(l)[1] min_ind = 0 max_ind = 0 for i in range(4): if i != v.index(min_s) and len(v[i]) / min_l >= 2: min_ind += 1 if i != v.index(max_s) and max_l / len(v[i]) >= 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
a=len(input()[2:]) b=len(input()[2:]) c=len(input()[2:]) d=len(input()[2:]) nice,k=0,'C' if a>=2*b and a>=2*c and a>=2*d:nice+=1;k='A' if 2*a<=b and 2*a<=c and 2*a<=d:nice+=1;k='A' if b>=2*a and b>=2*c and b>=2*d:nice+=1;k='B' if 2*b<=a and 2*b<=c and 2*b<=d:nice+=1;k='B' if c>=2*b and c>=2*a and c>=2*d:nice+=1;k='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
def prov(la, lb, lc, ld): if la/lb >= 2 and la/lc >= 2 and la/ld >= 2: return True return False def prov1(la, lb, lc, ld): if lb/la >= 2 and lc/la >= 2 and ld/la >= 2: return True return False a = list(input()) b = list(input()) c = list(input()) d = list(input()) a = a[2:] b = b[2:] 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
x = [] for i in range(0,4): y = raw_input() x.append([len(y)-2,i]) x.sort() y = ["A","B","C","D"] flag = 0 if(x[0][0]*2 <= x[1][0]): flag = 1 if(x[3][0]//2 >= x[2][0]): if(flag == 1): flag = 0 else: flag = 2 elif(x[3][0]//2 < x[2][0]): flag = max(flag,0) if(flag == 0): print...
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { ArrayList<Integer> lengths; public Main(ArrayList<Integer> l){ lengths=l; } public boolean bigger(int k){ int a = 2*lengths.get(k); int b = lengths.get((k+1)%4);...
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 TheChildAndHomework { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int[] a = new int[4]; for (int i = 0; i < 4; i++) { a[i] = cin.next().length() - 2; } cin.close(); char ans = 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
#include <bits/stdc++.h> int main() { int i, gt = 0, arr[4]; char var = 'C'; char A[102]; for (i = 0; i < 4; i++) { scanf("%s", A); arr[i] = strlen(A) - 2; } for (i = 0; i < 4; i++) { if (i == 0) { if (arr[0] >= (2 * arr[1]) && arr[0] >= (2 * arr[2]) && arr[0] >= (2 * arr[3])) { ...
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 compare(string s1, string s2) { return s1.length() < s2.length(); } int main() { string s[4]; for (auto &x : s) { cin >> x; } sort(s, s + 4, compare); int great = 0, temp; great += (s[3].length() - 2) >= 2 * (s[2].length() - 2); temp = great; great +...
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(zip((len(input()) - 2 for i in range(4)), "ABCD")) if 2 * a[2][0] <= a[3][0] and 2 * a[0][0] > a[1][0]: print(a[3][1]) elif 2 * a[2][0] > a[3][0] and 2 * a[0][0] <= a[1][0]: print(a[0][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 = raw_input()[2:] b = raw_input()[2:] c = raw_input()[2:] d = raw_input()[2:] alen = len(a) blen = len(b) clen = len(c) dlen = len(d) count = 0 if ((alen * 2 <= blen) and (alen * 2 <= clen) and (alen * 2 <= dlen)) or ((alen >= 2 * blen) and (alen >= 2 * clen) and (alen >= 2 * dlen)): count += 1 choice = 'A' if ...
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 math #q=int(input()) q=1 for _ in range(q): s1=input() s2=input() s3=input() s4=input() l1=len(s1)-2 l2=len(s2)-2 l3=len(s3)-2 l4=len(s4)-2 l=[l1,l2,l3,l4] ans=[] for i in range(4): flag1=True flag2=True for j in range(4): if j!=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
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator;...
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
/** * * @author Yesha Shah */ import java.util.Scanner; import java.util.Arrays; import java.util.HashMap; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int lenA = sc.next().length(); int lenB = sc.next().length(); 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
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] s = new String[4]; int[] lg = new int[4]; int min = Integer.MAX_VALUE, max = 0; int m = 0, n = 0; char[] ch = { 'A', 'B', 'C', 'D'}; for (int i = 0; i < 4; i++) { s[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; bool IsGreat(int i, int l[]) { bool flag = true; for (int j = 0; j < 4; j++) if (j != i && 2 * l[i] > l[j]) flag = false; if (flag == true) return true; flag = true; for (int j = 0; j < 4; j++) if (j != i && 2 * l[j] > l[i]) flag = false; return flag; } ...
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
CHOICES = ['A', 'B', 'C', 'D'] choicesLength = [] for x in xrange(0, 4): choicesLength.append(len(raw_input())-2) #print choicesLength sortedChoicesLength = sorted(choicesLength) #print sortedChoicesLength if (sortedChoicesLength[0]*2 <= sortedChoicesLength[1] and sortedChoicesLength[3] >= sortedChoicesLength[2]*2...
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 min(int a, int b) { if (a > b) a = b; return a; } int max(int a, int b) { if (a < b) a = b; return a; } int main() { char s[4][200]; int len[4], sor[4]; for (int i = 0; i < 4; i++) { scanf("%s", s[i]); len[i] = strlen(s[i]) - 2; sor[i] = len[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
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import static java.lang.Math.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()){ int[]len=new int[4]; int[]min=new int[4]; ...
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 int INF = 1 << 28; const long long INFL = 1LL << 62; int main() { string A, B, C, D; cin >> A >> B >> C >> D; int Asize = (int)(A).size() - 2; int Bsize = (int)(B).size() - 2; int Csize = (int)(C).size() - 2; int Dsize = (int)(D).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
a = input() b = input() c = input() d = input() #split a,b,c,d = a[2:],b[2:],c[2:],d[2:] lens = [(0,len(a)),(1,len(b)),(2,len(c)),(3,len(d))] lens = sorted(lens,key=lambda x:x[1]) count,ind = 0,-1 # print(lens) # minimum and max elements are the only candidates mini = lens[0][1] if(mini <= (lens[1][1]//2)): count+...
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 Main { public static Scanner input = new Scanner(System.in); public static void main(String[] args) { // TODO Auto-generated method stub String[] qu = new String[4]; while (input.hasNext()) { 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
def A(): a=raw_input()[2:] b=raw_input()[2:] c=raw_input()[2:] d=raw_input()[2:] la=len(a) lb=len(b) lc=len(c) ld=len(d) ag, bg, cg, dg=False, False, False, False if (2*la<=lb and 2*la<=lc and 2*la<=ld) or (2*lb<=la and 2*lc<=la and 2*ld<=la): ag=True if (2*lb<=la and...
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> int main() { char s[10][110]; int i, j, k, t; int a[10][2], len[10], max; while (scanf("%s%s%s%s", s[0], s[1], s[2], s[3]) != EOF) { len[1] = strlen(s[0]); len[2] = strlen(s[1]); len[3] = strlen(s[2]); len[4] = strlen(s[3]); memset(a, 0, sizeof(a)); for (i = 1, k...
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
from array import array a = array("i",[x for x in range(0,4)]) aa = ["" for x in range(0,4)] for x in range(0,4): aa[x] = input() for i in range(0,4): a[i]=len(aa[i])-2 d ,c = -1,0 for i in range(0,4): if a[i]<=a[(i+1)%4]/2 and a[i]<=a[(i+2)%4]/2 and a[i]<=a[(i+3)%4]/2 : d=i c+=1 if a[i]>=a[(i+1)%4]*2 and a[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
#!/usr/bin/python choices = [(x, raw_input()[2:]) for x in ['A', 'B', 'C', 'D']] valid = [x for x, s in choices if all(len(s) >= 2 * len(o) for y, o in choices if x != y) or all(2 * len(s) <= len(o) for y, o in choices if x != y)] if len(valid) == 1: print valid[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
a = [] b = [] for i in range(4): x = input() a.append(len(x[2:])) b.append(x) c = a.copy() a.sort() if 2 * a[0] <= a[1] and a[-1] < 2 * a[-2]: print(b[c.index(a[0])][0]) elif a[-1] >= 2 * a[-2] and 2 * a[0] > a[1]: print(b[c.index(a[-1])][0]) 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.*; public class Solution{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n,i,statement=0,small=-1,big=-1; int[] v; String[] s; v=new int[4]; s=new String[4]; 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
// author: Ahmed A.M import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); //S1 p1 = new S1(); p1.solve(); //S2 p2 = new S2(); p2.solve(); //S3 p3 = new S3(); p3.solve(); //S4 p4 = new S4(); p4.solv...
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 n, m, i, j, len[5]; char ch = '_', st[10005]; int main() { for (i = 1; i <= 4; i++) { cin >> st; len[i] = strlen(st) - 2; } if (len[1] * 2 <= len[2] && len[1] * 2 <= len[3] && len[1] * 2 <= len[4]) if (ch == '_') ch = 'A'; else ch = '-'...
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(): l = [] for i in range(4): x = raw_input() n = x[0] m = len(x.strip()[2:]) l.append({n: m}) l = sorted(l, key=lambda x: x.values()[0]) a = l[0].values()[0] p1 = False for i in range(1,4): b = l[i].values()[0] if b >= 2 * 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
#include <bits/stdc++.h> using namespace std; struct AA { int a, i; }; int cmp(AA b, AA c) { return b.a < c.a; } int main() { char a[120], b[120], c[120], d[120]; scanf("%s%s%s%s", a, b, c, d); AA aa[4]; aa[0].a = strlen(a) - 2; aa[0].i = 0; aa[1].a = strlen(b) - 2; aa[1].i = 1; aa[2].a = strlen(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
a = [len(map(str,raw_input()[2::])), 'A'] b = [len(map(str,raw_input()[2::])),'B'] c = [len(map(str,raw_input()[2::])),'C'] d = [len(map(str,raw_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]...
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
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main(String[] args) { String a,b,c,d; Scanner read=new Scanner(System.in); ...
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
#Author: squiggly_lines #Date: 02/06/2014 #Problem: 437A def main(): a,A = raw_input().split(".") b,B = raw_input().split(".") c,C = raw_input().split(".") d,D = raw_input().split(".") l = [(len(A),a),(len(B),b),(len(C),c),(len(D),d)] l.sort() if 2*l[0][0] <= l[1][0] and l[3][0] >= 2*l[2]...
PYTHON