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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
public class Algoritm {
... | 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 = raw_input();
b = raw_input();
c = raw_input();
d = raw_input();
a = a[2:];
b = b[2:];
c = c[2:];
d = d[2:];
ans = [];
la = len(a);
lb = len(b);
lc = len(c);
ld = len(d);
l = [la,lb,lc,ld];
#print l
#l.sort();
#if l[4]>
for i in range(4):
longer = True;
shorter = True;
for j in range(4):
if i==j:
... | 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=[]
for i in range(4): a.append(raw_input()[2:])
g=[i for i in range(4) if (all((len(a[i])*2<=len(a[j]) or j==i) for j in range(4)) or all((len(a[i])>=len(a[j])*2 or j==i) for j in range(4)))]
if (len(g)==1): print chr(g[0]+65)
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 | import sys
a = len(input()) - 2
b = len(input()) - 2
c = len(input()) - 2
d = len(input()) - 2
x = [0, 0, 0, 0]
if (a >= 2 * b and a >= 2 * c and a >= 2 * d )or (2 * a <= b and 2 * a <= c and 2 * a <= d):
x[0] = 1
if (b >= 2 * a and b >= 2 * c and b >= 2 * d )or (2 * b <=a and 2 * b <= c and 2 * b <= d):
x[... | 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() {
pair<int, char> pa[100];
string input;
int c[2];
char the_choice1, the_choice2;
for (int i = 0; i < 4; i++) {
cin >> input;
pa[i].first = (input.size() - 2);
pa[i].second = input[0];
}
sort(pa, pa + 4);
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 | 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):
g.append(i)
if len(g)==1:
print(chr(g[... | 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=[]
ans=''
for i in range(4):
a.append(len(input())-2)
for i in range(4):
flag=True
for j in range(4):
if i !=j :
if a[i]*2>a[j]:
flag=False
if flag:
ans+='ABCD'[i]
flag=True
for j in range(4):
if i!= j:
if a[i]<a[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 | 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,key=lambda x:x[0])
c=0
m=[]
for i in range(1,4):
if 2*l[0][0]<=l[i][0]:
c+=1
if c==3:
m.append(l[0][1])
c=0
for i in range(0,3):
if l[3][0]>=2*l[i][0]:
c+=1
if c==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 | #!/usr/bin/env python
# encoding: utf-8
cs = [raw_input() for _ in range(4)]
cs.sort(key=len)
f = lambda x: len(x)-2
t = 0
if 2*f(cs[0]) <= f(cs[1]):
ans = cs[0][0]
t += 1
if f(cs[3]) >= 2*f(cs[2]):
ans = cs[3][0]
t += 1
if t == 0 or t == 2:
ans = 'C'
print ans
| 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 | # -*- coding: utf-8 -*-
# https://codeforces.com/problemset/problem/437/a
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 <... | 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 {
public static void main (String[]args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] arr = new String[4];
for(int i=0; i<4; i++){
StringTokenizer st = new StringTokenizer(br.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 | a = input()[2:]
b = input()[2:]
c = input()[2:]
d = input()[2:]
lst = [a,b,c,d]
lst.sort(key = len)
if 2*len(lst[0]) <= len(lst[1]) and 2*len(lst[2]) > len(lst[3]) or 2*len(lst[0]) > len(lst[1]) and 2*len(lst[2]) <= len(lst[3]):
if 2*len(lst[0]) <= len(lst[1]) and 2*len(lst[2]) > len(lst[3]):
if lst[0] == a... | 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 out;
string s1, s2, s3, s4;
cin >> s1 >> s2 >> s3 >> s4;
string s11 = s1.substr(2);
string s12 = s2.substr(2);
string s13 = s3.substr(2);
string s14 = s4.substr(2);
int l1 = s11.length();
int l2 = s12.length();
int l3 = s13.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().strip()[2:]
b = input().strip()[2:]
c = input().strip()[2:]
d = input().strip()[2:]
res = ['A' , 'B' , 'C' , 'D']
arr = [len(a) , len(b) , len(c) , len(d)]
mic = 0
mac = 0
m1 = 0
m2 = 0
for i in range(4):
temp = 0
temp1 = 0
for j in range(4):
if i == j:
continue
if ar... | 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 math, operator
def main():
answ = {}
larger = 0
smaller = 0
line1 = raw_input()
answ['A'] = int(len(line1[2:]))
line2 = raw_input()
answ['B'] = int(len(line2[2:]))
line3 = raw_input()
answ['C'] = int(len(line3[2:]))
line4 = raw_input()
answ['D'] = int(len(line4[2:]))
minkey = min(answ, key=ans... | 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 | # -*- coding: utf-8 -*-
#ᕕ┌◕ᗜ◕┐ᕗ HELLO HELLO HELLO ᕕ┌◕ᗜ◕┐ᕗ
a = raw_input()[2:]
b = raw_input()[2:]
c = raw_input()[2:]
d = raw_input()[2:]
ga,gb,gc,gd = False,False,False,False
la,lb,lc,ld = len(a),len(b),len(c),len(d)
if (la >= 2*lb and la >= 2*lc and la >= 2*ld) or (2*la <= lb and 2*la <= lc and 2*la <= ld):
ga ... | 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 sys
from collections import defaultdict, Counter
from itertools import permutations, combinations
from math import sin, cos, asin, acos, tan, atan, pi
sys.setrecursionlimit(10 ** 6)
def pyes_no(condition, yes = "YES", no = "NO", none = "-1") :
if condition == None:
print (none)
elif condition :
pri... | 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 a[12];
char b[4] = {'A', 'B', 'C', 'D'};
string s;
int main() {
for (int i = 0; i < 4; i++) {
cin >> s;
int p = 0;
for (int j = 2; j < s.length(); j++)
if ((s[j] >= 'a' && s[j] <= 'z') || (s[j] >= 'A' && s[j] <= 'Z')) p = 1;
if (p == 1) a[i] = 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 = []
for i in range(4):
t = raw_input()
a.append((len(t)-2,t[:1]))
a.sort()
f = 0
if a[0][0]*2 <= a[1][0]:
f += 1
ans = a[0][1]
if a[2][0]*2 <= a[3][0]:
f += 1
ans = a[3][1]
if f == 1:
print ans
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=len(input())-2
b=len(input())-2
c=len(input())-2
d=len(input())-2
ans=''
if (a*2<=b and a*2<=c and a*2<=d) or (a>=b*2 and a>=c*2 and a>=d*2):
ans+='A'
if (b*2<=a and b*2<=c and b*2<=d) or (b>=a*2 and b>=c*2 and b>=d*2):
ans+='B'
if (c*2<=b and c*2<=a and c*2<=d) or (c>=b*2 and c>=a*2 and c>=d*2):
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;
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;
void swap(int* a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
}
int main() {
int a[4][2];
string s[4];
for (int i = 0; i < 4; i++) {
cin >> s[i];
a[i][0] = s[i].length() - 2;
a[i][1] = i;
}
for (int i = 0; i < 3; i++)
for (int j = 0; j < 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 | a={"A":len(input()[2:]),"B":len(input()[2:]),"C":len(input()[2:]),"D":len(input()[2:])}
mi=min(a.values())
ma=max(a.values())
l=list(a.values())
c=0
s=0
key_list = list(a.keys())
val_list = list(a.values())
for i in a.values():
if i==mi:
continue
elif mi<=i/2:
c+=1
for i in a.values():
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 | #include <bits/stdc++.h>
using namespace std;
int ar[4];
string s[4];
char b;
inline void input() {
for (int i = 0; i < 4; i++) {
cin >> s[i];
ar[i] = s[i].size() - 2;
}
}
int lon(int a) {
for (int i = 0; i < 4; i++) {
if (a != i) {
if (ar[a] < (ar[i] * 2)) return 0;
}
}
if (b >= '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 | s1={}
s2=[]
for index in range (4):
x=len(raw_input())-2
s1[x]= chr(ord('A')+index)
s2.append(x)
s2.sort()
ans =-1
if s2[0]*2<=s2[1]:
ans=s1[s2[0]]
if s2[3]>=s2[2]*2:
if ans==-1:
ans = s1[s2[3]]
else:
ans=-1
if ans==-1:
print "C"
else:
print ans
| 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;
bool cmp(string& l, string& r) { return (l.size() < r.size()); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
vector<string> v;
string s;
int f1 = 0, f2 = 0;
for (long long int i = 0; i < 4; i++) {
cin >> s;
v.push_back... | 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 Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in=new Scanner(System.in);
String[] s=new String[4];
for(int i=0;i<4;i++)
s[i]=in.next();
int max=s[0].length()-2;
int min=max;
int minIndex=0,maxIndex=0,ans=0,flagmax=0,flagmin=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 | ######################################################################
# Write your code here
import sys
from math import *
input = sys.stdin.readline
#import resource
#resource.setrlimit(resource.RLIMIT_STACK, [0x10000000, resource.RLIM_INFINITY])
#sys.setrecursionlimit(0x100000)
# Write your code here
RI = lambda : [... | 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 cho[4][200];
int main() {
int len[4];
int c = 0;
int ans = -1;
for (int i = 0; i < 4; i++) {
scanf("%s", cho[i]);
len[i] = strlen(cho[i]) - 2;
}
for (int i = 0; i < 4; i++) {
if (len[i] * 2 <= len[(i + 1) % 4] && len[i] * 2 <= len[(i + 2) % 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 | #include <bits/stdc++.h>
using namespace std;
template <class T>
void _R(T &x) {
cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(long long &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
template <class T>
void _W... | 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>
char g[1000];
int s[20][20];
int main() {
int i, j, temp, p, k = 0, c = 0, b = 0;
s[0][1] = 'A';
for (i = 0; i < 4; i++) {
gets(g);
s[i][0] = strlen(g) - 2;
s[i][1] = s[0][1] + i;
}
for (j = 4; j > 0; j--) {
for (i = 0; i < (j - 1); i++) {
if (s[i][0] > s[i + 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 | import java.io.*;
import java.util.*;
/**
* Created by Yu ShangHsin on 2014/6/4.
*/
public class Main{
public static void main(String[] args){
Scan scan = new Scan();
Choice[] array = new Choice[4];
for(int i=0;i<4;i++) array[i] = new Choice(scan.next());
Arrays.sort(array);
if(array[0].length <= array[1... | 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 A437 {
public static void main(String[] args) {
Scanner nn = new Scanner(System.in);
String s1 = nn.nextLine();
String s2 = nn.nextLine();
String s3 = nn.nextLine();
String s4 = nn.nextLine();
/*int n1 = s1.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 java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class codeforces_r250_div2_A {
MyScanner in;
PrintWri... | 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.io.OutputStreamWriter;
import java.io.PrintWriter;
public class CF437A {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
string a[4];
int i;
int c[4];
for (i = 0; i < 4; i++) {
cin >> a[i];
c[i] = a[i].length() - 2;
}
sort(c, c + 4);
if (2 * c[0] <= c[1] && 2 * c[2] <= c[3]) {
cout << "C";
} else if (2 * c[0] <= c[1]) {
for (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 | import java.util.*;
public class Main {
static int flag[] = new int [27];
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int a = scan.nextLine().length()-2;
int b = scan.nextLine().length()-2;
int c = scan.nextLine().length()-2;
int d = scan.nextLine().length()-2;
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() {
char a[200], b[200], c[200], d[200], answ;
int l1, l2, l3, l4, cnt;
scanf("%s", a);
scanf("%s", b);
scanf("%s", c);
scanf("%s", d);
l1 = strlen(a) - 2;
l2 = strlen(b) - 2;
l3 = strlen(c) - 2;
l4 = strlen(d) - 2;
cnt = 0;
if ((l1 >= 2 * l... | 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.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int[] len = new int[4];
int[] len1 = new int[4];
boolean[] a = new boolean[4];
Str... | 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;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
double A = 0;
double B = 0;
double ... | 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()
eles = [a, b , c , d]
elems = [a[2:], b[2:], c[2:], d[2:]]
#print(elems)
g = []
l = [len(elems[0]),len(elems[1]), len(elems[2]), len(elems[3])]
#print(l)
for i in range(4):
ele = l[i]
r = []
for j in range(4):
if i == j :
continue... | 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.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author nasko
*/
public class Main ... | 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.HashMap;
import java.util.Scanner;
public class TheChildandHomework {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s1 = scanner.nextLine();
String s2 = scanner.nextLine();
String s3 = scanner.nextLine();
String s... | 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 | dic = {}
for i in range(4):
choice,s = input().split('.')
dic[choice] = len(s)
count = 0
for i in dic:
check1=check2=1
for j in dic:
if i!=j:
if dic[i]<dic[j]*2:
check1 = 0
if dic[i]>dic[j]/2:
check2 = 0
if check1 or check2:
cou... | 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 len(string s) {
int orig = s.size();
orig -= 2;
return orig;
}
int main() {
string choices[4];
for (int c = 0; c < 4; c++) {
cin >> choices[c];
}
int smallcount = 0;
char smallmeow;
int bigcount = 0;
char bigmeow;
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 | a = raw_input()
b = raw_input()
c = raw_input()
d = raw_input()
aa = len(a) - 2
bb = len(b) - 2
cc = len(c) - 2
dd = len(d) - 2
def find_twice(a1, b1, b2, b3):
if (a1 >= 2 * b1) and (a1 >= 2 * b2) and (a1 >= 2 * b3):
#print '1'
return True
elif (a1 <= b1 / 2) and (a1 <= b2 / 2) and (a1 <= b3... | 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 s[6];
cin >> s[0];
cin >> s[1];
cin >> s[2];
cin >> s[3];
int A[4], B[4];
for (int i = 0; i <= 3; i++) A[i] = 0, B[i] = 0;
char ok[4] = {'A', 'B', 'C', 'D'};
int flag = 0;
for (int i = 0; i <= 3; i++) {
for (int j = 0; j <= 3; 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.util.*;
public class CF437D2A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] oc1, oc2;
int[] l = new int[4];
oc1 = new int[4];
oc2 = new int[4];
for(int i = 0; i < 4; i++) {
String line = in.nextLine().split("\\.")[1];
l[i] = line.length();
... | 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()[2:]
b = input()[2:]
c = input()[2:]
d = input()[2:]
l = sorted([(len(x), ans) for (x, ans) in [(a, 'A'), (b, 'B'), (c, 'C'), (d, 'D')]])
if l[0][0] * 2 <= l[1][0] and l[2][0] * 2 <= l[3][0]:
print('C')
elif l[0][0] * 2 <= l[1][0]:
print(l[0][1])
elif l[2][0] * 2 <= l[3][0]:
print(l[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 | #include <bits/stdc++.h>
using namespace std;
bool cp(pair<string, int> p1, pair<string, int> p2) {
return p1.second > p2.second;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string a[4];
int t, flg1 = 0, flg2 = 0;
vector<pair<string, int> > v1;
for (int i = 0; i < 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 | __author__ = 'MoustaphaSaad'
def compare(o ,b, c, d):
if len(o) / 2 >= len(b) and len(o) / 2 >= len(c) and len(o) / 2 >= len(d):
return 1
if len(o) <= len(b) / 2 and len(o) <= len(c) / 2 and len(o) <= len(d) / 2:
return 1
return 0
a = raw_input()
b = raw_input()
c = raw_input()
d = raw_inp... | 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 a, b, c, d;
bool f = 0, g = 0;
cin >> a >> b >> c >> d;
pair<int, char> m[4];
m[0].first = a.length() - 2;
m[0].second = 'A';
m[1].first = b.length() - 2;
m[1].second = 'B';
m[2].first = c.length() - 2;
m[2].second = 'C';
m[3].first... | 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 | mcqs = {}
coding = {0:"A",1:"B",2:"C",3:"D"}
for i in range(4):
opt = input()
mcqs[i] = len(opt)-2
# print(mcqs)
sorted_mcqs = sorted(mcqs,key=mcqs.get)
# print(sorted_mcqs)
minn,maxx = mcqs[sorted_mcqs[0]] , mcqs[sorted_mcqs[-1]]
if(maxx / minn <2):
print("C")
else:
ismin = True
ismax = 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 | #include <bits/stdc++.h>
using namespace std;
char result = 'C';
vector<pair<int, char> > len(4);
int main() {
int ii, jj;
string str;
bool tmpLow, tmpHigh;
int resCount = 0;
for (ii = 0; ii < 4; ii++) {
getline(cin, str);
len[ii] = make_pair((str.length() - 2), str[0]);
}
for (ii = 0; (ii < 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a[4], tmp = 0, i, j, k;
string s;
bool b1, b2;
for (i = 0; i < 4; i++) {
cin >> s;
a[i] = s.length() - 2;
}
for (i = 0; i < 4; ++i) {
b1 = true;
b2 = true;
for (j = 0; j < 4; ++j) {
if (j != i) {
if (2 * a[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 | def main():
a = len(raw_input()) - 2
b = len(raw_input()) - 2
c = len(raw_input()) - 2
d = len(raw_input()) - 2
ans = []
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.append("A")
if (b >= 2 * a and b >= 2 * c and b >= 2 * d) or (2 * b <= a and 2 * b <= c and 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 main() {
ios_base::sync_with_stdio(0);
string a[4];
for (int i = 0; i < 4; i++) {
cin >> a[i];
}
int res[2];
int mn = 9999;
int mx = 0;
for (int i = 0; i < 4; i++) {
if (mn > a[i].size() - 2) {
res[0] = i;
mn = min(mn, int(a[i].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 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
*
* @author sousnake
*/
public class A {
public static void main(String [] args) thro... | 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 A {
public static void main(String[] args) throws IOException, NumberFormatException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
Scanner s = new Scanner(System.in);
int[] length ... | 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 | arr = [input() for i in range(4)]
arr = sorted([[arr[i][:1], len(arr[i][2:])] for i in range(4)], key=lambda x: x[1])
ans = []
if arr[0][1] * 2 <= arr[1][1]:
ans.append(arr[0][0])
if arr[3][1] >= arr[2][1] * 2:
ans.append(arr[3][0])
if len(ans) == 1:
print(ans[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 | def get_key (x):
for key,value in dicti.items():
if x==value:
return key
a=input()
b=input()
c=input()
d=input()
count1=0
count2=0
arr=[len(a)-2,len(b)-2,len(c)-2,len(d)-2]
dicti={'A':len(a)-2,'B':len(b)-2,'C':len(c)-2,'D':len(d)-2}
arr.sort()
if arr[0]*2<=arr[1]:
count1+=1
if arr[-1]>=2*arr... | 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 main():
lens = []
for i in range(4):
lens.append(len(raw_input())-2)
cnt = 0
for i in range(4):
x = 0
y = 0
for j in range(4):
if i != j:
if 2*lens[i] <= lens[j]:
x += 1
if 2*lens[j] <= lens[i]:
y += 1
# print "x=",x,"y=",y
if x==3 or y==3:
cnt += 1
v = i
# print lens[... | 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()[2:]
b=input()[2:]
c=input()[2:]
d=input()[2:]
L=[a,b,c,d]
S="ABCD"
x=0
e=[]
for i in range(4):
l=True
s=True
for j in range(4):
if(j==i):
continue
if(len(L[i])<len(L[j])*2):
l=False
if(len(L[j])<len(L[i])*2):
s=False
if(l 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 | s=[raw_input() for i in range(4)]
d=[all(len(s[i])-2 <= (len(s[j])-2)/2 for j in range(4) if i != j) or all(len(s[i])-2 >= (len(s[j])-2)*2 for j in range(4) if i != j) for i in range(4)]
if sum(d)==1:
print s[d.index(True)][:1]
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 | import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class read {
private static Scanner in;
public static void main(String[] args) throws IOException {
in = new Scanner(System.in);
HashMap<String, Integer> map = new HashMap<>();
... | 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 | R = lambda:raw_input()[2:]
A = [R(), R(), R(), R()]
dbl, hlf, grt = [ True ] * 4, [ True ] * 4, []
for i in xrange(4):
ilen = len(A[i])
for j in xrange(4):
if i != j:
jlen = len(A[j])
if jlen * 2 > ilen:
dbl[i] = False
if ilen * 2 > jlen:
hlf[i] = False
if dbl[i] or hlf[i]:
grt.append(i)
if 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 | def main():
s = "ABCD"
arr = [len(input()) - 2 for i in range(4)]
decides = []
Min = min(arr)
tmp = arr[:]; tmp.remove(Min)
if Min * 2 <= min(tmp):
decides.append(s[arr.index(Min)])
Max = max(arr)
tmp = arr[:]; tmp.remove(Max)
if Max >= max(tmp) * 2:
decides.app... | 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 for x in range(4)]
b=sorted(a)
tall=True
if(b[0]*2<=b[1] and b[2]*2<=b[3]):
print("C")
exit()
if(b[0]*2<=b[1]):
print(chr(65+a.index(b[0])))
exit()
elif(b[2]*2<=b[3]):
print(chr(65+a.index(b[3])))
exit()
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.util.Scanner;
public class Round250Div2A {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
int minIdx = 0, maxIdx = 0;
int[] length = 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 | A = raw_input()
B = raw_input()
C = raw_input()
D = raw_input()
letters = ['A', 'B', 'C', 'D']
a = []
a.append(len(A)-2)
a.append(len(B)-2)
a.append(len(C)-2)
a.append(len(D)-2)
sign_min = 0
sign_max = 0
minn = min(a)
maxx = max(a)
for i in a:
if i >= 2*minn:
sign_min = sign_min+1
if 2*i <= maxx:
... | 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 sys
inf = float("inf")
# sys.setrecursionlimit(10000000)
# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 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.util.*;
import java.io.*;
public class gibberish {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner(System.in);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
String[] vals = new String[4];
for (int k = 0; k < 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 | s=0
c=0
p=[]
a=[]
for i in range(4):
a.append(input())
for i in range(4):
for k in range(4):
if i!=k:
if len(a[i])-2<=(len(a[k])-2)/2:
s+=1
if (len(a[i])-2)/2>=len(a[k])-2:
c+=1
if s==3 or c==3:
p.append(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 | #include <bits/stdc++.h>
using namespace std;
int main() {
string str1;
getline(cin, str1);
string str2;
getline(cin, str2);
string str3;
getline(cin, str3);
string str4;
getline(cin, str4);
vector<int> len;
int i;
int l1 = 0;
for (i = 2; i <= (str1.size() - 1); i++) {
l1++;
}
len.push_b... | 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 = ['A','B','C','D']
l1 = [A,B,C,D]
r = []
q = []
for i in range(4):
y = l1[i]
l1.pop(i)
if 2*y<=min(l1):
r.append(l[i])
elif y>=2*max(l1):
q.append(l[i])
l1.insert(i,y)
if len(r)==1 and len(q)!=1:
print... | 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(string a, string b) { return a.size() < b.size(); }
int main() {
vector<string> answers;
string line;
while (getline(cin, line)) {
stringstream ss(line);
answers.push_back(line);
}
sort(answers.begin(), answers.end(), compare);
string shorte... | 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution 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.io.*;
import java.util.*;
public class SolutionA {
public void solve(){
O[] ar = new O[4];
ar[0] = new O(nextString().length() - 2, 'A');
ar[1] = new O(nextString().length() - 2, 'B');
ar[2] = new O(nextString().length() - 2, 'C');
ar[3] =... | 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.math.BigInteger;
import java.util.*;
public class Main {
static InputStream inputStream = System.in;
static OutputStream outputStream = System.out;
static Scanner in = new Scanner(inputStream);
static PrintWriter out = new PrintWriter(outputStream);
public static void main(Strin... | 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 homework {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String A=sc.next();
String B=sc.next();
String C=sc.next();
String D=sc.next();
long a=A.length()-2,b=B.length()-2,c=C.length()-2,d=D.length()... | 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
s1=raw_input()
s2=raw_input()
s3=raw_input()
s4=raw_input()
l=[[] for x in xrange(4)]
l[0].append(s1)
l[1].append(s2)
l[2].append(s3)
l[3].append(s4)
a1=len(s1)-2
a2=len(s2)-2
a3=len(s3)-2
a4=len(s4)-2
l[0].append(a1)
l[1].append(a2)
l[2].append(a3)
l[3].append(a4)
l.sort(key=lambda x: x[1])
#print l
if(l[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 suM(cca):
su = ""
for j in range(len(cca)):
su+=cca[j]
return su
ans = []
a = input().split('.')
b = input().split('.')
c = input().split('.')
d = input().split('.')
ca = a[1].split('_');cb = b[1].split('_'); cc = c[1].split('_'); cd = d[1].split('_')
ca = suM(ca);cb = suM(cb);cc = suM(cc)... | 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 | m, choice = 0, sorted([(len(input()) - 2, i) for i in 'ABCD'])
if 2 * choice[0][0] <= choice[1][0]: m += 1
if choice[3][0] >= 2 * choice[2][0]: m += 2
print(['C', choice[0][1], choice[3][1], 'C'][m]) | 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.Arrays;
public class TheChildNHomework_CFORCE{
public static void main(String[] args) throws IOException{
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
//System.out.println("Enter : ");
String str[]=new String[4];int arr[]=new int[4];
for(int i=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;
int main() {
string s;
int a[4];
for (int i = 0; i < 4; i++) {
cin >> s;
a[i] = s.length() - 2;
}
vector<int> res;
char ans[] = {'A', 'B', 'C', 'D'};
int k = 3;
while (k >= 0) {
bool op1 = true, op2 = true;
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 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
while(scan.hasNext()){
String a=scan.nextLine();
String b=scan.nextLine();
String c=scan.nextLine();
String d=scan.nextLine();
int aa=a.length()-2;
int bb=b.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 java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
public class D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Task t=new Task();
t.solve(scan);
scan.close();
}
}
class Task{
class Pair{
int first;... | 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;
struct node {
char a[105];
int num;
char flag;
} s[5];
int main() {
memset(s, 0, sizeof(s));
for (int i = 1; i <= 4; i++) {
cin >> s[i].a;
s[i].num = strlen(s[i].a) - 2;
}
s[1].flag = 'A';
s[2].flag = 'B';
s[3].flag = 'C';
s[4].flag = 'D';
int ... | 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 | ml = []
t = 4
while t:
s = input()
ml.append([len(s)-2, s])
t -= 1
ml.sort()
ans = ''
if 2*ml[0][0] <= ml[1][0]:
ans += ml[0][1][:1]
if ml[-1][0] >= 2*ml[-2][0]:
ans += ml[-1][1][:1]
if len(ans) == 1:
print(ans)
else:
print('C')
###### thanking telegram for solutions ######
'''__________... | 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() {
int k = 0, j = 0, l = 0, m = 0;
int z = 0, x = 0, p = 0, v = 0;
string a, b, c, d;
cin >> a >> b >> c >> d;
if ((b.size() - 2 >= 2 * (a.size() - 2)) &&
(b.size() - 2 >= 2 * (c.size() - 2)) &&
(b.size() - 2 >= 2 * (d.size() - 2)))
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 | t = [raw_input().split('.') for i in range(4)]
t.sort(key=lambda x: len(x[1]))
r = []
if len(t[0][1]) <= (len(t[1][1]) / 2):
r.append(t[0][0])
if len(t[-1][1]) / 2 >= (len(t[-2][1])):
r.append(t[-1][0])
if len(r) == 1:
print r[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 | nums = map(lambda x: len(raw_input().strip())-2, range(4))
res = []
for e1, num1 in enumerate(nums):
twice_shorter = twice_longer = True
for e2, num2 in enumerate(nums):
if e1 != e2:
if num1 < 2*num2:
twice_longer = False
if (2*num1) > num2:
twice... | 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;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
int len[4];
int main() {
ios_base::sync_... | 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.Scanner;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Mahmoud Aladdin <aladdin3>
*/
public class Main {
public static void main(String[] args) {
InputS... | 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 Solution {
public static int max(int a,int b){
if(a>b){
return a;
}
return b;
}
public static int min(int a,int b){
if(a<b){
return a;
}
return b;
}
public static void main(S... | 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 k1, k2, k3, k4, a[4], i;
char x[105], b[105], c[105], d[105];
scanf("%s", x);
scanf("%s", b);
scanf("%s", c);
scanf("%s", d);
k1 = strlen(x) - 2;
k2 = strlen(b) - 2;
k3 = strlen(c) - 2;
k4 = strlen(d) - 2;
a[0] = k1;
a[1] = k2;
a[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):
a.append(len(raw_input()) - 2)
b = ['A','B','C','D']
ans = []
for i in range(4):
ok,ok1 = 0,0
for j in range(4):
if j != i:
if a[i] >= 2*a[j]:
ok += 1
elif 2*a[i] <= a[j]:
ok1 += 1
if ok == 3 or ok1 == 3:
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 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String a = scan.nextLine();
String b = scan.nextLine();
String c = scan.nextLine();
String d = scan.nextLine();
choice A = new choice(a.length() - 2,"A");
choice B = new choice(b.lengt... | 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=raw_input()
b=raw_input()
c=raw_input()
d=raw_input()
a=[[len(a)-2,'A'],[len(b)-2,'B'],[len(c)-2,'C'],[len(d)-2,'D']]
a.sort()
ok=0
if 2*a[0][0]<=a[1][0]:
ans=a[0][1]
ok+=1
if a[3][0]>=2*a[2][0]:
ans=a[3][1]
ok+=1
if ok==2 or ok==0:
ans='C'
print ans
| 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.Scanner;
public class A437 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char choice = 'C';
int index = 2; // corresponding index for C in lengths array
int counter = 0; // counts number of great choices
int[] lengths = new int[4];
for(int i=0; i... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.