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.*;
import java.lang.*;
public class aChildAndHomework {
public static void main (String[] args) throws java.lang.Exception {
int[] arr = new int[4];
Scanner in = new Scanner(System.in);
int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE, minRU = Integer.MAX_VALUE, maxRU =... | 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 = []
b = ['A','B','C','D']
a.append(len(raw_input())-2)
a.append(len(raw_input())-2)
a.append(len(raw_input())-2)
a.append(len(raw_input())-2)
ans1 = -1
ans2 = -1
for i in xrange(4):
cnt = 0
for j in xrange(4):
if i != j:
if a[i]>=(2*a[j]):
cnt += 1
if cnt == 3:
ans1 = i
for i in xrange(4):
cnt = ... | 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.*;
import java.util.*;
public class A {
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
public void run() {
String[] s = new String[4];
int[] len = new int[4];
ArrayList<Integer> ans = new ArrayList<Integer>();
for (int i = 0; i < len.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 | #include <bits/stdc++.h>
using namespace std;
struct Q {
int l;
char p;
} Q[5];
bool cmp(const struct Q &a, const struct Q &b) { return (a.l <= b.l); }
int main() {
char arr[1000];
char E, F, G, H;
scanf("%c%c", &Q[0].p, &E);
gets(arr);
Q[0].l = strlen(arr);
scanf("%c%c", &Q[1].p, &F);
gets(arr);
Q[... | 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 A437 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] choice = new String[4];
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;
for (int i=0; i<4; i++) {
String description... | 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(raw_input())-2
b = len(raw_input())-2
c = len(raw_input())-2
d = len(raw_input())-2
dic = {a:'A',b:'B',c:'C',d:'D'}
#print dic
ar = [a,b,c,d]
ar.sort()
#print ar
if ar[0]*2<=ar[1] and ar[3]<ar[2]*2:
print dic[ar[0]]
elif ar[3]>=ar[2]*2 and ar[0]*2>ar[1]:
print dic[ar[3]]
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.awt.Point;
import java.util.*;
public class SinIsh1 {
public static void main(String [] args){
Scanner in = new Scanner(System.in);
Point array[]=new Point[4];
boolean flag=false;
boolean flag1=false;
for(int i=0;i<4;i++){
String str=in.next();
array[i]=new Point(str.length()-2,i);
}
Arrays.sort(array,new 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 | def main():
mode="filee"
if mode=="file":f=open("test.txt","r")
#f.readline()
#input()
get = lambda :[(f.readline()[:-1] if mode=="file" else input())]
a={}
for i in range(4):
[y]=get()
a[chr(65+i)]=len(y[2:])
maxx=max(a.values())
minn=min(a.values())
for i,j in 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 | a = input();b = input();c= input();d= input()
list = [[len(a)-2,'A'],[len(b)-2,'B'],[len(c)-2,'C'],[len(d)-2,'D']]
list.sort()
ans = ''
t1 = False
t2 = False
if list[0][0]*2 <= list[1][0]:
ans = list[0][1]
t1 = True
if list[-1][0] >= list[-2][0]*2:
ans = list[-1][1]
t2 = True
if (t1 and t2) or t1 == Fal... | 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 void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] choices = new String[4];
for (int i = 0; i < 4; i++) {
String line = input.nextLine();
choices[i] = line.substring(2);
}
int count = 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 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class ChildAndHomeWork{
//CF 437A div1
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStre... | JAVA |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.StringTokenizer;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.Math.floor;
import static java.lang.Math.c... | 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.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import jav... | 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 a437
{
/************************ SOLUTION STARTS HERE ************************/
//DONT FORGET TO COMMIT AND PUSH TO GITHUB
private static void solve(FastScanner s1, FastWriter out){
String a[]=new String[4];
int len[]=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;
vector<pair<int, char> > V;
map<char, int> A;
int main() {
string x;
cin >> x;
V.push_back(make_pair(x.size() - 2, 'A'));
cin >> x;
V.push_back(make_pair(x.size() - 2, 'B'));
cin >> x;
V.push_back(make_pair(x.size() - 2, 'C'));
cin >> x;
V.push_back(make_p... | CPP |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | 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 (b*2<=a and c*2<=a and d*2<=a):
ans+='A'
if (b*2<=a and b*2<=c and b*2<=d) or (a*2<=b and c*2<=b and d*2<=b):
ans+='B'
if (c*2<=b and c*2<=a and c*2<=d) or (b*2<=c and a*2<=c and d*2<=c):
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 | import java.util.Scanner;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] descriptions = new String[4];
for (int i = 0; i < descriptions.length; i++) {
descriptions[i] = sc.next().substring(2);
}
System.out.pri... | 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.Comparator;
import java.util.List;
import java.util.Scanner;
public class A_The_Child_And_Homework {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
List<String> l = new ArrayList<>(4);
l.add(inpu... | 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 Main {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
boolean aGreat, bGreat, cGreat, dGreat;
int aLength, bLength, cLength, dLength;
aLength = in.next().length() - 2;
bLen... | JAVA |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b, c, d;
cin >> a >> b >> c >> d;
int la = a.size() - 2, lb = b.size() - 2, lc = c.size() - 2,
ld = d.size() - 2, fa = 0, fb = 0, fc = 0, fd = 0;
if ((2 * la <= lb && 2 * la <= lc && 2 * la <= ld) ||
(la >= 2 * lb && la >= 2 * lc &... | 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 second[4];
for (long long i = 0; i < 4; i++) cin >> second[i];
long long a[4] = {0};
a[0] = second[0].length() - 2;
a[1] = second[1].length() - 2;
a[2] = second[2].length() - 2;
a[3] = second[3].length() - 2;
long long cnt = 0;
long lon... | 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 | z=[len(input()[2:]) for _ in " "*4]
s,g=-1,-1
for i in range(4):
ok=1
for j in range(4):
if i!=j and 2*z[i]>z[j]:ok=0
if ok:s=i
for i in range(4):
ok=1
for j in range(4):
if i!=j and z[i]<2*z[j]:ok=0
if ok:g=i
if s!=-1 and g!=-1:print("C")
elif s!=-1:print(chr(65+s))
elif g!=-1: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 |
import java.util.Scanner;
import java.util.TreeMap;
public class test {
public static void main(String args[]){
Scanner s=new Scanner(System.in);
String a=s.next();
String b=s.next();
String c=s.next();
String d=s.next();
int al=a.length()-2;
int bl=b.length()-2;
int cl=c.length()-2;
int dl=d.length()-2;
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 | /**
* @(#)HomeWork.java
*
*
* @author Suyash Bhalla
* @version 1.00 2016/6/15
*/
import java.io.*;
public class HomeWork {
public static void main(String args[])throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String a=br.readLine();
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 | p = [raw_input().split('.') for _ in xrange(4)]
p = sorted([(len(x[1]), x[0]) for x in p])
ans = []
if (p[0][0] * 2 <= p[1][0]):
ans.append(p[0][1])
if (p[-1][0] >= p[-2][0] * 2):
ans.append(p[-1][1])
if len(ans) == 1:
print ans[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 |
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class A {
private static final int SIZE = 4;
public static void main(String[] args) throws IOException, ParseException {
new A().doJob();
}
privat... | 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;
pair<int, string> p[4];
for (int i = 0; i < 4; i++) {
cin >> s;
p[i] = make_pair(s.length() - 2, s);
}
sort(p, p + 4);
int b = -1;
if (p[1].first / 2 >= p[0].first) b = 0;
if (p[3].first / 2 >= p[2].first) {
if (b == 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 | a = raw_input()[2:]
b = raw_input()[2:]
c = raw_input()[2:]
d = raw_input()[2:]
al = len(a)
bl = len(b)
cl = len(c)
dl = len(d)
arr = [0,0,0,0]
ans = ['A','B','C','D']
if al>=2*(max(bl,cl,dl)) or al*2<= (min(bl,cl,dl)):
arr[0]+=1
if bl>=2*(max(al,cl,dl)) or bl*2<= (min(al,cl,dl)):
arr[1]+=1
if cl>=2*(max(bl,al... | 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() {
vector<pair<long long int, long long int> > v;
vector<long long int> gt;
for (int i = 0; i < 4; i++) {
string s;
cin >> s;
v.push_back({s.size() - 2, i + 1});
}
sort(v.begin(), v.end());
if (v[0].first * 2 <= v[1].first) gt.push_back(v[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 | # /**
# * Ashesh Vidyut (Drift King) *
# */
sta = str(raw_input())[2:]
stb = str(raw_input())[2:]
stc = str(raw_input())[2:]
std = str(raw_input())[2:]
lena = len(sta)
lenb = len(stb)
lenc = len(stc)
lend = len(std)
ansa = False
ansb = False
ansc = False
ansd = False
if lena <= float(lenb)/2 and lena <= float(lenc)/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 | l = [input() for _ in range(4)]
m = list(map(lambda x : len(x[2:]),l))
res = []
for i in l :
y = 1
r1 = True
r2 = True
for j in l :
if i != j :
if (len(i[2:]) >= len(j[2:])*2) and r1 :
y *= 1
r2 = False
elif (len(i[2:]) <= len(j[2:])/2) and r2:
r1 = False
... | 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 The_Child_and_Homework {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
String s[] = new String[4];
for(int i = 0 ; i < 4 ; i++)
s[i] = in.next();
double len[] = new double[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 | var a = readline()
var b = readline()
var c = readline()
var d = readline()
lena = a.substring(2).length
lenb = b.substring(2).length
lenc = c.substring(2).length
lend = d.substring(2).length
var letters = ["A", "B", "C", "D"]
var lengths = [lena, lenb, lenc, lend]
var great = false
var greatLetter = "A"
var numGreat... | 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 | choices = [len(raw_input()[2:]) for i in xrange(4)]
answers = []
for i in xrange(4):
c, d = [], []
for j in xrange(4):
if i == j:
continue
a = choices[i]
b = choices[j]
if a >= 2 * b:
c.append(j)
if a <= b / 2:
d.append(j)
if len(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 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
vector<int> v(4, 0);
int cnt = 0;
for (int i = 0; i < 4; i++) {
string s;
cin >> s;
v[i] += s.length() - 2;
}
char ch = 'C';
int ans = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4;... | CPP |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | function trim(s) {
return s.replace(/^\s+|\s+$/gm, '');
}
function tokenize(s) {
return trim(s).split(/\s+/);
}
function tokenizeIntegers(s) {
var tokens = tokenize(s);
for (var i = 0; i < tokens.length; i += 1) {
tokens[i] = parseInt(tokens[i], 10);
};
return tokens;
}
function main() {
var info = [];
for... | 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 | from sys import stdin
a=stdin.readlines()
hi = 0
b=[]
for i in a:
j=i.strip().split('.')[1]
if len(j)>hi:
hi = len(j)
b.append(len(j))
lo = b[0]
for i in b:
if i<lo:
lo = i
#print lo,hi
#print b
ans = ['A','B','C','D']
fir = 0
sec = 0
resm=resh=0
for i in xrange(len(b)):
if b[i]==lo:
resm=i
if b[i]==hi:
r... | 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() {
int i, j, l[4];
char s[105];
int n1, n2;
int f, c = 0;
for (i = 1; i <= 4; i++) {
scanf("%s", &s);
l[i] = strlen(s) - 2;
}
for (i = 1; i <= 4; i++) {
n1 = 0;
n2 = 0;
for (j = 1; j <= 4; j++) {
if (i != j) {
if (l[i] <= l[j] / 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.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
public class ACM {
static boolean v[][];
static int ar[][];
static int w = 8;
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;
string k[] = {"A", "B", "C", "D"};
int len[5];
int mn = 500;
int cnt, cnt2;
int mx = -500;
int posmn, posmx;
int main() {
ios_base::sync_with_stdio(0);
string a[5];
for (int i = 1; i <= 4; ++i) {
cin >> a[i];
len[i] = a[i].length() - 2;
mn = min(mn, 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.*;
import java.io.*;
public class A
{
Reader in;
PrintWriter out;
int i = 0, j = 0;
void solve()
{
//START//
int[] desc = new int[4];
for (i = 0; i < 4; i++)
{
desc[i] = in.next().length()-2;
}
int choices = 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 | ls = []
count=0
ls.append( raw_input().strip())
ls.append( raw_input().strip())
ls.append( raw_input().strip())
ls.append( raw_input().strip())
ls[0] = ls[0][2:len(ls[0])]
ls[1] = ls[1][2:len(ls[1])]
ls[2] = ls[2][2:len(ls[2])]
ls[3] = ls[3][2:len(ls[3])]
char=-1
for i in xrange(4):
flag=0
for j in xrange(4):
... | 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
alpha = ["A", "B", "C", "D"]
choices = []
for i in range(4):
choices.append(len(sys.stdin.readline().strip()) - 2)
lengths = list(choices)
lengths.sort()
if lengths[0] * 2 <= lengths[1] and lengths[3] >= lengths[2] * 2:
print "C"
elif lengths[0] * 2 <= lengths[1]:
print alpha[choices.index(le... | PYTHON |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | a = raw_input()[2:]
b = raw_input()[2:]
c = raw_input()[2:]
d = raw_input()[2:]
lena = len(a)
lenb = len(b)
lenc = len(c)
lend = len(d)
lengthList = [len(a), len(b), len(c), len(d)]
choice = 2
count = 0
for k in xrange(4):
if (lengthList[k] >= 2 * lengthList[(k+1)%4]) and (lengthList[k] >= 2 * lengthList[(k+2)%4]... | PYTHON |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | # python 3
"""
"""
from operator import itemgetter
def the_child_and_homework(answers_list: list) -> str:
answers_list.sort(key=itemgetter(1))
# print(answers_list)
min_len = answers_list[0][1]
choices = ""
if min_len == answers_list[1][1]:
pass
else:
if answers_list[1][1] >= 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() {
int small = 1000, big = 0, k, x, y, z;
char ch = 'C', chs, chl;
bool bol1 = false, bol2 = false;
string a, b, c, d;
cin >> a >> b >> c >> d;
k = a.size() - 2;
x = b.size() - 2;
y = c.size() - 2;
z = d.size() - 2;
if (k < x && k < y && k < z)... | 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 gcd(int a, int b) { return (b != 0 ? gcd(b, a % b) : a); }
int lcm(int a, int b) { return (a / gcd(a, b) * b); }
int main(int argc, const char **argv) {
string a[4];
int l[4], lm[4], i, x, c, d;
for (int i = 0; i < 4; i++) {
cin >> a[i];
l[i] = a[i].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 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s[4];
pair<int, int> max, min;
int l[4];
for (__typeof(4) i = 0; i < 4; i++) {
cin >> s[i];
l[i] = s[i].length() - 2;
}
for (__typeof(4) i = 0; i < 4; i++) {
if (i == 0) {
max.first = min.first = 0;
max.second = min.se... | 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 a, b, c, d;
getline(cin, a);
getline(cin, b);
getline(cin, c);
getline(cin, d);
int a1 = a.length() - 2;
int b1 = b.length() - 2;
int c1 = c.length() - 2;
int d1 = d.length() - 2;
int great = 0;
int great1 = 0;
if (a1 >= b1 * 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 | #!/usr/bin/env pypy
"""
Created on Mon Dec 14 13:18:46 2020
@author: yash
"""
"""
_ _ ____ _ ____
| | __ _(_) / ___|| |__ _ __ ___ ___ | _ \ __ _ _ __ ___
_ | |/ _` | | \___ \| '_ \| '__/ _ \/ _ \ | |_) / _` | '_ ` _ \
| |_| | (_| | | ___) | | | |... | 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 = [[] for i in range(4)]
for i in range(4):
s[i] = raw_input()
l = []
pos = f = 0
for i in range(4):
l.append(len(s[i])-2)
for i in range(4):
c1 = c2 = 0
for j in range(4):
if j != i and l[j] >= l[i]*2:
c1 += 1
if j != i and l[j]*2 <= l[i]:
c2 += 1
if c1 == ... | 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 get_len(x) :
return len(x)
a=list(input() for i in range(4))
a.sort(key=get_len)
s=(2*len(a[0])<=len(a[1])+2)
l=(2*len(a[2])<=len(a[3])+2)
print("C" if s^l==0 else (a[0][0] if s else a[3][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 | a=(raw_input())
b=(raw_input())
c=(raw_input())
d=(raw_input())
p=[len(a)-2,len(b)-2,len(c)-2,len(d)-2]
q=['A','B','C','D']
maxi=max(p)
mini=min(p)
ans=2
k=0
for i in xrange(4):
big=True
small=True
for j in xrange(4):
if i!=j:
if p[i]<(2*p[j]):
big=False
if p... | 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 a[200];
char b[200];
char c[200];
char d[200];
char x;
int i;
int len[4];
scanf("%c", &x);
scanf("%c", &x);
scanf("%s\n", a);
scanf("%c", &x);
scanf("%c", &x);
scanf("%s\n", b);
scanf("%c", &x);
scanf("%c", &x);
scanf("%s\n", c);
scanf("%c", &... | CPP |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
string a, b, c, d;
pair<int, char> arr[10];
bool cek1, cek2;
int main() {
cin >> a;
cin >> b;
cin >> c;
cin >> d;
arr[0] = make_pair(a.length() - 2, 'A');
arr[1] = make_pair(b.length() - 2, 'B');
arr[2] = make_pair(c.length() - 2, 'C');
arr[3] = make_pair(d.... | CPP |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] l = new int[4];
for(int i=0;i<4;i++) {
l[i] = sc.next().length()-2;
}
int goodindex = -1;
for(int i=0;i<4;i++) {
boolean longer = true;
boolean shorter = true;
for... | 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];
bool judge1(int x);
bool judge2(int x);
int main(void) {
char str[105];
for (int i = 0; i < 4; i++) {
scanf("%s", str);
l[str[0] - 'A'] = strlen(str + 2);
}
int flag = 0, ans = 0;
for (int i = 0; i < 4; i++) {
if (judge1(i) || judge2(i)) {
flag++;
ans... | 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() {
vector<pair<int, char> > nb(4);
for (auto &i : nb) {
string a;
cin >> a;
i.first = a.size() - 2;
i.second = a[0];
}
sort(nb.begin(), nb.end());
int ax(0);
int ax1(0);
for (int i = 1; i < 4; ++i) {
if (nb[0].first * 2 <= nb[i].f... | 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.InputStreamReader;
import java.io.IOException;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is ... | 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 ar[4];
string s;
for (int i = 0; i < (4); i++) {
cin >> s;
ar[i] = s.length() - 2;
}
string res = "ABCD";
char small = 'n', large = 'n';
int cnt = 0, len;
for (int i = 0; i < 4; i++) {
cnt = 0;
len = ar[i];
for (int j = 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 | import java.util.* ;
import java.lang.* ;
import java.io.*;
public class javaTemplate {
static FastReader sc = new FastReader();
// static Scanner sc = new Scanner(System.in) ;
public static void main(String[] args) {
String s[] = new String[4] ;
int length[] = new int[4] ;
for(int i = 0 ; i< 4 ; i++)... | JAVA |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
void me() {
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
void stop() {}
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
string convert(long long 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int mi = INT_MAX, ma = 0, ri, ra, cnti = 0, cnta = 0;
char s[5][105];
for (int i = 0; i < 4; i++) scanf("%s", s[i]);
for (int i = 0; i < 4; i++) {
if (strlen(s[i]) - 2 < mi) mi = strlen(s[i]) - 2, ri = i;
}
for (int i = 0; i < 4; i++)
if (mi... | 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']
lines = []
for i in range(4):
lines.append(raw_input())
lengths = []
for line in lines:
lengths.append(len(line) - 2)
greats = []
for i in range(len(lines)):
double = True
half = True
for j in range(len(lines)):
if i != j:
double = double and length... | 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;
long long f(long long n) {
long long res = 0;
while (n) {
if (n % 10 != 0) {
res = res * 10 + (n % 10);
}
n /= 10;
}
long long rev = 0;
while (res) {
rev = (rev * 10) + (res % 10);
res /= 10;
}
return rev;
}
int32_t main() {
string ... | CPP |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s1, s2, s3, s4;
cin >> s1 >> s2 >> s3 >> s4;
int a = s1.length() - 2;
int b = s2.length() - 2;
int c = s3.length() - 2;
int d = s4.length() - 2;
int count = 0;
char ans;
if (2 * a <= b && 2 * a <= c && 2 * a <= d) {
ans = 'A';
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 | import java.util.Scanner;
public class ThechildandHomework {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input= new Scanner(System.in);
String s1= input.next();
int t1 = s1.length()-2;
String s2 = input.next();
int max=Integer.MIN_VALUE;... | 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.Arrays;
import java.util.*;
import java.util.StringTokenizer;
public class Main {
PrintWriter out;
BufferedReader input;
Main() {
try {
input = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter(new FileWriter("output.... | JAVA |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String str[];
str=new String[4];
Scanner in=new Scanner (System.in);
int i,j,gc=0,ans = 0;
boolean flag;
for(i=0;i<4;i++)
{
str[i]=in.nextLine();
}
for(i=0;i<4;i++)
{
//twice shorter
flag=true;
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 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.*;
import java.io.*;
public class NewMain_113 {
public static void main(String[] args) {
// TODO code a... | JAVA |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
# def solve(firstLine):
def solve(lines):
l = list(map(lambda x: len(x[2:]), lines))
min_len = min(l)
great = []
others = list(filter(lambda x: x >= 2 * min_len, l))
if len(others) == 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 | #include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
const int INF((1 << 30) - 1);
const int MAXN();
int a[4];
int main() {
for (int i = 0; i < 4; i++) {
string s;
cin >> s;
a[i] = s.size() - 2;
}
int ans = -1, cnt = 0;
for (int i = 0; i < 4; i++) {
int p1 = 0, p2 = 0;
fo... | CPP |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | Astr = input()
Bstr = input()
Cstr = input()
Dstr = input()
A_len = len(Astr[2:])
B_len = len(Bstr[2:])
C_len = len(Cstr[2:])
D_len = len(Dstr[2:])
arr = [A_len, B_len, C_len, D_len]
det = "ABCD"
last_det = []
for i in range(4):
last_arr = arr.copy()
last_arr.pop(i)
if arr[i] >= 2 * last_arr[0] and arr[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 | Astr = input()
Bstr = input()
Cstr = input()
Dstr = input()
A_len = len(Astr[2:])
B_len = len(Bstr[2:])
C_len = len(Cstr[2:])
D_len = len(Dstr[2:])
arr = [A_len, B_len, C_len, D_len]
det="ABCD"
last_det=[]
for i in range(4):
last_arr=arr.copy()
last_arr.pop(i)
if arr[i] >= 2 * last_arr[0] and arr[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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k;
string s[4];
for (i = 0; i < 4; i++) cin >> s[i];
int sizes[4];
for (i = 0; i < 4; i++) sizes[i] = s[i].size() - 2;
sort(sizes, sizes + 4);
if (sizes[0] <= 0.5 * sizes[1] && sizes[3] < 2 * sizes[2]) {
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 | a= raw_input()
b= raw_input()
c= raw_input()
d = raw_input()
l =[[len(a)-2,"A"], [len(b)-2,"B"],[len(c)-2,"C"],[len(d)-2,"D"]]
l.sort()
if 2* l[0][0] <= l[1][0] and 2*l[2][0] <= l[3][0]:
print("C")
elif 2* l[0][0] <= l[1][0]:
print (l[0][1])
elif 2 * l[2][0] <= l[3][0]:
print (l[3][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 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
int val[maxn];
long long res = 0;
int main() {
ios::sync_with_stdio(false);
string s[4];
cin >> s[0] >> s[1] >> s[2] >> s[3];
pair<int, char> l[4];
for (int i = 0; i < 4; i++) {
l[i].first = s[i].size() - 2;
l[i].second = '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 | #include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e) {
cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
cout << e1 << " " << e2 << " " << e3 << endl;
}
... | 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 MaxLength = 10001;
typedef int arr[MaxLength];
string read_string() {
static char s[MaxLength];
gets(s);
string st = "";
for (int i = 0; s[i]; i++) st += s[i];
return st;
}
int main() {
string s1 = read_string(), s2 = read_string(), s3 = read_string(),... | 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 a[4], knt, p;
char s[4][210];
int main() {
scanf("%s%s%s%s", s[0], s[1], s[2], s[3]);
for (int i = 0; i < 4; i++) a[i] = strlen(s[i]) - 2;
int flag[4] = {'A', 'B', 'C', 'D'};
for (int i = 0; i < 4; i++) {
int cnt = 0, rnt = 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 | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static ... | 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.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Pranay2516
*/
public class... | 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.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
public class A {
static class t {
char i;
String s;
t(char i, String s) {this.i=i; this.s=s;}
}
stati... | 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.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | 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 | keys = []
values = []
for i in range(4):
k,v = input().split(".")
values.append(v)
keys.append(k)
great = []
for i in range(4):
c = 0
for j in range(4):
if i!=j and len(values[i]) <= 0.5 * len(values[j]):
c += 1
if i!=j and len(values[i]) >= 2 * len(values[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 | /**
* Created by den on 6/1/14.
*/
import java.io.*;
import java.util.*;
public class A extends Thread {
private void solve() throws IOException {
int[] ansLength = new int[4];
String[] ans = new String[4];
for (int i = 0; i < 4; i++) {
ans[i] = nextToken();
ansL... | 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 | l1=[]
for i in range(4):
l1.append((len(input())-2,i))
l1.sort()
ans1,ans2=-1,-1
if 2*l1[0][0]<=l1[1][0]:
ans1=l1[0][1]
if 2*l1[2][0]<=l1[3][0]:
ans2=l1[3][1]
if ans1==-1 and ans2==-1:
print('C')
elif ans1!=-1 and ans2!=-1:
print('C')
else :
if ans1==-1:
print(chr(ans2+65))
else :
... | PYTHON3 |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | import java.util.*;
// "static void main" must be defined in a public class.
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] ans = new String[4];
ans[0] = "A";
ans[1] = "B";
ans[2] = "C";
ans[3] = "D";
... | 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 | from __future__ import print_function
w,a = raw_input().split('.')
w,b = raw_input().split('.')
w,c = raw_input().split('.')
w,d = raw_input().split('.')
l=[]
l.append(len(a))
l.append(len(b))
l.append(len(c))
l.append(len(d))
l.sort()
cn=0
res=""
if (2*l[0]<=l[1]):
if len(a)==l[0]:
res+='A'
elif len(b)==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 | # coding: utf-8
# (C) 2014, Laybson Plismenn / UFCG
a = raw_input()
b = raw_input()
c = raw_input()
d = raw_input()
l = [len(a[2:]), len(b[2:]), len(c[2:]), len(d[2:])]
m = ""
n = ""
for i in xrange(len(l)):
maior = 0
menor = 0
for j in xrange(len(l)):
if l[i] <= l[j] / 2.0:
menor += 1
if me... | PYTHON |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | a = input()
b = input()
c = input()
d = input()
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 | __author__ = 'forevercode'
CevapA = [str(temp) for temp in raw_input().split(".")]
CevapB = [str(temp) for temp in raw_input().split(".")]
CevapC = [str(temp) for temp in raw_input().split(".")]
CevapD = [str(temp) for temp in raw_input().split(".")]
Cevaplar = [int(s) for s in range(0, 4)]
tempCevaplar = [0 for temp... | 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.*;
import java.util.*;
public class test {
int INF = (int)1e9;
long MOD = 1000000007;
void solve(InputReader in, PrintWriter out) throws IOException {
String a = in.next().substring(2);
String b = in.next().substring(2);
String c = in.next().substring(2);
... | JAVA |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int s=Integer.MAX_VALUE,s2=Integer.MAX_VALUE,l=0,l2=0;
String arr[]=new String[4];
char a='a',b='b';
for(int i=0;i<4;i++)
{
arr[i]=sc.next();
int n=arr[i].length()-2;
if(n<... | JAVA |
437_A. The Child and Homework | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
Fortunately the child knows how to solve such complicated test. The chi... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b, c, d;
cin >> a >> b >> c >> d;
long long n[4], m[4];
m[0] = n[0] = a.length() - 2;
m[1] = n[1] = b.length() - 2;
m[2] = n[2] = c.length() - 2;
m[3] = n[3] = d.length() - 2;
sort(n, n + 4);
if (2 * n[0] <= n[1] and 2 * n[2] > n[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 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class A {
public static int solve(String[] choices, int[] len){
boolean []bestMore = new boolean[4];
boolean []bestLess = new boolean[4];
boolean bestM = true;
boolean bestL = true;
for(int j = 0; j < 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;
int used[100001];
int main() {
string a[4];
for (long long i = 0; i < 4; i++) cin >> a[i];
int cnt = 0;
int nom = 2;
for (long long i = 0; i < 4; i++) {
int ok1 = 0;
int ok2 = 0;
for (long long j = 0; j < 4; j++)
if (i != j) {
if ((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 = input()
b = input()
c = input()
d = input()
cnta=0
cntb=0
cntc=0
cntd=0
x = len(a)-2
y = len(b)-2
z = len(c)-2
w = len(d)-2
#print(x,y,z,w)
if (x>=2*y and x>=2*z and x>=2*w) or (2*x<=y and 2*x<=z and 2*x<=w):
cnta+=1
if (y>=2*x and y>=2*z and y>=2*w) or (2*y<=x and 2*y<=z and 2*y<=w):
cntb+=1
if (z>=2*y and... | 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(raw_input())-2
B=len(raw_input())-2
C=len(raw_input())-2
D=len(raw_input())-2
count=0
flag_A=False
flag_B=False
flag_C=False
flag_D=False
if(A >= 2*B and A >= 2*C and A >= 2*D):
flag_A=True
count+=1
if(2*A <= B and 2*A <= C and 2*A <= D):
flag_A=True
count+=1
if(B >= 2*A and B >= 2*C and B >= 2*D):
flag_B=Tr... | 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().strip()[2:]) for i in range(4)]
wond = set()
for i in range(4):
good = 1
for j in range(4):
if i != j and a[i] > a[j] // 2:
good = 0
if good:
wond.add(i)
for i in range(4):
good = 1
for j in range(4):
if i != j and a[i] // 2 < a[j]:
go... | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.