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
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
list = [0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10,1,4,2] n = int(input()) print(list[n])
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
a = 0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2 n = int(input()) p...
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.util.Scanner; public class Convert { public static void main(String[] args) { Scanner s = new Scanner(System.in); int[] A = { 0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1,...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int shit; int main() { int WhatTheFuckIsThis[100] = { 0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> int ans[100] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
n=int(input());print([int("0111212152215121e1515221f22541410121e122e1614221025151f2d221d1240"[n],36),n//16+49+(n>>6)*214][n>>4>1 and n&15==0])
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int arr[100] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
print [-1,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10,1,4,2][input()]
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> const int a[105] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
print([0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267][int(input())])
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; const int db[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int number[100] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> const int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
/* Solution: Apparently this is a squence on an online sequence website. Wow... that's unique. */ import java.util.*; import java.io.*; public class mystery000001 { int N; int[] seq = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 1...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int a; int mas[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int a[100] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
s = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2] n = int(input()...
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int d[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
l = input() c = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1, 15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2, 1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5, 1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10, 1,4,2] print c[l-1]
PYTHON
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int a[64] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267}; int main...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.util.*; public class F { public static void main(String[] args) { int[] A = new int[]{1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1, 15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2, 1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5, 1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.awt.Point; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Main { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new Stri...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int a[10010] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int easy[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> const int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#!/bin/bash/python # Date: 2014-04-16 # Author: shijinzhan # Status: # Note: index = int(input()) A0000001 = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1,...
PYTHON3
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { /** * @param args */ public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader( System.in)); int x = Integer.valueOf(reader...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; const int maxn = 1e2; int n, arr[maxn] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, ...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
import java.util.*; public class Main{ public static void main(String[] args){ int[] seq = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4...
JAVA
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int main() { int num[200] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1,...
CPP
409_F. 000001
Input The input contains a single integer a (1 ≤ a ≤ 64). Output Output a single integer. Examples Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
2
12
#include <bits/stdc++.h> using namespace std; int a[226982]; int v[1000], prime[1000], m; int gcd(int x, int y) { return x % y == 0 ? y : gcd(y, x % y); } void dabiao() { a[1] = 1; a[30] = 4; a[56] = a[60] = 13; a[36] = a[40] = 14; a[24] = a[54] = 15; a[48] = 52; a[64] = 267; } void work2(int p, int 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.io.BufferedReader; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.StringTokenizer; public...
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 a[4]; int main() { string s; int suma = 0, sumb = 0, sumc = 0, sumd = 0; bool o1 = false, o2 = false; cin >> s; a[0] = suma = s.length() - 2; cin >> s; a[1] = sumb = s.length() - 2; cin >> s; a[2] = sumc = s.length() - 2; cin >> s; a[3] = sumd = 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
k = lambda x: len(x) - 2 c = sorted([raw_input() for _ in range(4)], key=k) l = map(k, c) f, g = 2 * l[0] <= l[1], 2 * l[2] <= l[3] if f and not g: print c[0][0] elif g and not f: print c[3][0] else: print 'C'
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { vector<pair<int, int> > t; for (int i = 0; i < 4; i++) { string s; cin >> s; t.push_back(make_pair(s.size() - 2, i)); } sort(t.begin(), t.end()); bool flag = false; if (t[0].first * 2 <= t[1].first) { if (t[2].first * 2 <= t[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
a = input()[2:] b = input()[2:] c = input()[2:] d = input()[2:] zc = 0 z = -100 if (len(a)*2 <= len(b) and len(a)*2 <= len(c) and len(a)*2 <= len(d)) or (len(a) >= len(b)*2 and len(a) >= len(c)*2 and len(a) >= len(d)*2): zc += 1 z = 'A' if (len(b)*2 <= len(a) and len(b)*2 <= len(c) and len(b)*2 <= len(d)) or...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.util.Arrays; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Himalay(himalayjoriwal@gmail.com) */ 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
a,b,c,d=input(),input(),input(),input() a=len(a)-2 b=len(b)-2 c=len(c)-2 d=len(d)-2 e=False if 2*a<=c and 2*a<=b and 2*a<=d or a>=2*c and a>=2*b and a>=2*d: e='A' if 2*b<=a and 2*b<=c and 2*b<=d or b>=2*a and b>=2*c and b>=2*d: if e==False: e='B' else: e='C' if 2*c<=a and 2*c<=b and 2*c<=d or c>...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.*; import java.math.BigInteger; import java.util.*; public class CodeForces { private final BufferedReader reader; private final PrintWriter writer; private StringTokenizer tokenizer; private void solve() { Pair[] pairs = new Pair[4]; String next; 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> int main() { int a[4], b = 0, c = 0, d = 0, e; a[1] = a[2] = a[3] = a[0] = 0; char m[] = "ABCD"; char s[4][200]; for (int i = 0; i < 4; i++) { scanf("%s", s[i]); a[i] = strlen(s[i]) - 2; } for (int i = 0; i < 4; i++) { c = 0; d = 0; int f = b; if (i == 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
L = [0 for i in xrange(4)] for i in xrange(4): L[i] = len(raw_input()) - 2; s = "ABCD" G = []; for i in xrange(4): l = m = True; for j in xrange(4): if i != j: m = m and L[i] >= 2*L[j]; l = l and 2*L[i] <= L[j]; # print i,m,l if m or l: G.append(s[i]); # print G if ...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> int main() { char a[200], b[200], c[200], d[200], e = 0, k1 = 0, k2 = 0, k3 = 0, k4 = 0, k5 = 0; int l1, l2, l3, l4; scanf("%s", a); scanf("%s", b); scanf("%s", c); scanf("%s", d); l1 = strlen(a) - 2; l2 = strlen(b) - 2; l3 = strlen(c) - ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.io.*; import java.util.*; public class A{ public static boolean DEBUG = false; public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int 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 java.util.Scanner; public class Solution { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); String[] a = { in.nextLine(), in.nextLine(), in.nextLine(), in.nextLine() }; String small = null, large = null; for (int i = 0; i < 4; i++) { boolean ...
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() { vector<pair<int, char> > input(4); for (int i = 0; i < 4; ++i) { string s; cin >> s; input[i] = {s.size() - 2, 'A' + i}; } sort(input.begin(), input.end()); bool min = 2 * input[0].first <= input[1].first, max = input[3].first >= 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): x = input().strip()[2:] a.append(len(x)) good = [] for i in range(4): fl = True for j in range(4): if j != i and a[i] / a[j] < 2: fl = False if fl: good.append(i) else: fl = True for j in range(4): if j != i an...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; vector<bool> primes(100006, false); void sieve() { for (long long i = 3; i <= 100006; i += 2) { primes[i] = 1; } for (long long i = 3; i <= 100006; i += 2) { if (primes[i] == 1) { for (long long j = i * i; j <= 100006; j += i) { primes[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
#include <bits/stdc++.h> char s[5][200], ans; int l[5], a[5], b[5], anss; int main() { for (int i = 1; i <= 4; i++) scanf("%s", s[i]), l[i] = strlen(s[i]) - 2; for (int i = 1; i <= 4; i++) { int a = 1, b = 1; for (int j = 1; j <= 4; j++) if (j != i) a &= (l[j] >= l[i] * 2), b &= (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
#include <bits/stdc++.h> using namespace std; int main() { string a, b, c, d; int la, lb, lc, ld; bool ba, bb, bc, bd; cin >> a >> b >> c >> d; la = a.length() - 2; lb = b.length() - 2; lc = c.length() - 2; ld = d.length() - 2; ba = bb = bc = bd = 0; if (la * 2 <= lb && la * 2 <= lc && la * 2 <= ld)...
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,b,c,d=input(),input(),input(),input() a,b,c,d=list(a),list(b),list(c),list(d) a,b,c,d=a[2:],b[2:],c[2:],d[2:] alen,blen,clen,dlen=len(a),len(b),len(c),len(d) listt=[] listt.append([alen,"A"]) listt.append([blen,"B"]) listt.append([clen,"C"]) listt.append([dlen,"D"]) value1=value2=False listt=sorted(listt) # print(lis...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; struct sth { string s; int len, bh; } c[5]; inline bool comp(sth a, sth b) { return a.len < b.len; } int gs; char Ans; int main() { for (int i = 1; i <= 4; i++) { cin >> c[i].s; c[i].len = c[i].s.size() - 2; c[i].bh = i; } sort(c + 1, c + 1 + 4, comp);...
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[4], b, c, d; int main() { vector<int> A, B; char g1 = ' ', g2 = ' '; char C[] = "ABCD"; A.resize(4); B.resize(4); for (int i = 0; i < 4; ++i) { cin >> a[i]; A[i] = a[i].size() - 2; B[i] = A[i]; } sort(B.begin(), B.end()); if (B[0] <= 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=raw_input() b=raw_input() c=raw_input() d=raw_input() li=[[len(a[2:]),'A'],[len(b[2:]),'B'],[len(c[2:]),'C'],[len(d[2:]),'D']] li.sort() if(li[0][0]*2<=li[1][0] and li[2][0]*2<=li[3][0]): print "C" elif(li[0][0]*2<=li[1][0]): print li[0][1] elif(li[2][0]*2<=li[3][0]): print li[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; template <typename T> void print2dvector(vector<vector<T> > v) { cout << "A 2d vector:" << endl; int a = v.size(); int b = v[0].size(); if (a <= 15 && b <= 15) { for (int i = 0; i < a; i++) { for (int j = 0; j < b; j++) { cout << setw(4) << v[i][j]...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import java.util.Arrays; import java.util.Scanner; /** * * @author JAI */ public class Main{ /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner sc=new Scanner(System.in); String ch1,ch2,ch3,ch4; St...
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 src(int ar[10], int r, int key) { for (int i = 0; i < r; i++) { if (ar[i] == key) return i; } } int main() { string a, b, c, d; cin >> a; cin >> b; cin >> c; cin >> d; int l1 = a.length() - 2; int l2 = b.length() - 2; int l3 = c.length() - 2; 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.io.*; import java.util.*; public class D250 { public static void main(String[] args) throws Exception{ new D250().solve(); } void solve() throws Exception { Reader in = new Reader(); PrintWriter out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(System.out))); int a = in.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
import sys #sys.stdin = open('input.txt', 'r') t, a = input().split('.') t, b = input().split('.') t, c = input().split('.') t, d = input().split('.') k = [0]*4 if 2*len(a) <= len(b) and 2*len(a) <= len(c) and 2*len(a) <= len(d): k[0]=1 if 2*len(b) <= len(a) and 2*len(b) <= len(c) and 2*len(b) <= len(d): k[1]=1 if 2*le...
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> int main() { char ch; int a[5] = {0}, i, count = 1, max = -10000, min = 10000, max_num, min_num, K; while (count <= 4) { scanf("%c", &ch); if (ch != '\n') { a[count]++; } else { a[count] -= 2; count++; } } for (i = 1; i <= 4; i++) { if (a[i] > max...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
//package codeforces.active; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import java.util.StringTokenizer; public class TheChildAndHomework { public static void main(String[] ar...
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.*; import java.util.*; public class HomeWork { public static void main(String args[])throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String a=br.r...
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 arr[4]; pair<int, char> asd[4]; vector<char> vec; for (int i = 0; i < 4; i++) { cin >> arr[i]; asd[i].first = arr[i].length() - 2; asd[i].second = arr[i].at(0); } sort(asd, asd + 4); bool f1 = 0, f2 = 0; for (int i = 1; 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
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; public 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
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return (a - b) ? gcd(a - b, b) : a; } void solve() { string s[4]; char res = 0; for (int i = 0; i < 4; i++) cin >> s[i]; vector<int> len(4); for (int i = 0; i < 4; i++) len[i] = s[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.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import...
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.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; import javax.swing.text.StyledEditorKit.BoldAction; public class TaskA_437 { public static void main(String[] args) { input(); ...
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.PrintWriter; import java.util.Scanner; public class Second { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String a = in.nextLine().substring(2); String b = in.nextLine().substring(2); String c = in.nextLine().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
import java.io.*; import java.util.Scanner; public class TaskA { public static void main(String args[]) { Scanner in = new Scanner(System.in); PrintStream out = System.out; int[] v = new int[4]; for (int i = 0; i < 4; i++) { v[i] = in.nextLine().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.Scanner; public class A { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s1=sc.nextLine(); String s2=sc.nextLine(); String s3=sc.nextLine(); String s4=sc.nextLine(); int l[]={0,s1.length()-2,s2.length()-2,s3.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 java.util.*; public class Main { public static void main(String[]args){ Scanner sc=new Scanner(System.in); int small=0; int big=0; pair[] abcd=new pair[4]; abcd[0]=new pair('A',sc.nextLine().length()-2); abcd[1]=new pair('B',sc.nextLine().length()-2); abcd[2]=new pair('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
from sys import stdin inp = [l[2:] for l in stdin.readlines()] choices = [] for l in inp: if l[-1:] == "\n": choices.append(l[:-1]) else: choices.append(l) lens = [len(a) for a in choices] smin = min(sorted(lens)[1:]) smax = max(sorted(lens)[:-1]) great = 0 gn = 0 for i in range(4): c = choices[i] if (...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
''' Created on ٠١‏/٠١‏/٢٠١٥ @author: mohamed265 ''' num = [] num.append(len(input())-2) num.append(len(input())-2) num.append(len(input())-2) num.append(len(input())-2) temp = min(num) index = num.index(temp) count = 0 for i in range(4): if i != index and num[i] >= 2 * temp: count += 1 temp = max(num) ind...
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().strip() a = a[2:] b = raw_input().strip() b = b[2:] c = raw_input().strip() c = c[2:] d = raw_input().strip() d = d[2:] x = [len(a),len(b),len(c),len(d)] y = list(x) y.sort() if (2*y[0]) <= y[1] and (2*y[2]) <= y[3]: print 'C' elif (2*y[0]) <= y[1]: print chr(ord('A')+x.index(y[0])) elif (2*y[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() { string x[4]; int y[4], z[4] = {0}, a[4] = {0}, Counter = 0, s; for (int i = 0; i < 4; i++) { cin >> x[i]; y[i] = x[i].length() - 2; } for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i != j) { if (y[i] >= y[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
r = [raw_input().strip()[2:] for i in xrange(4)] r2 = r[:] r2.sort(key=len) if len(r2[0])*2<=len(r2[1]) and len(r2[3])>=2*len(r2[2]): print 'C' elif len(r2[0])*2<=len(r2[1]): print 'ABCD'[r.index(r2[0])] elif len(r2[3])>=2*len(r2[2]): print 'ABCD'[r.index(r2[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.io.*; import java.util.*; public class Main { public static void main(String[] args)throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s[]=new String[4]; int arr[][]=new int[4][2]; String str[]={"A","B","C","D"}; 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; const char a[4] = {'A', 'B', 'C', 'D'}; int nho, dem, A[5]; string s; bool check(int j) { bool b = true; for (int i = 1; i <= 4; ++i) { if (i == j) continue; if (A[j] * 2 > A[i]) { b = false; break; } } if (b) return true; b = true; for (...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = [] for i in range(4): c = input() a.append((len(c) - 2, c[0])) a.sort() gs = a[0][0] * 2 <= a[1][0] gl = a[3][0] >= a[2][0] * 2 if (gs and gl) or (not gs and not gl): print('C') else: print(a[0][1] if gs else a[3][1])
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { string str1, str2, str3, str4; getline(cin, str1); getline(cin, str2); getline(cin, str3); getline(cin, str4); int s1, s2, s3, s4; s1 = str1.size() - 2; s2 = str2.size() - 2; s3 = str3.size() - 2; s4 = str4.size() - 2; int c1 = 0; int c2...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; char chA[150], chB[150], chC[150], chD[150]; int t, len1, len2, len3, len4; char p; int main() { while (cin >> chA) { cin >> chB; cin >> chC; cin >> chD; len1 = strlen(chA); len1 -= 2; len2 = strlen(chB); len2 -= 2; len3 = strlen(chC); ...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; char x[4][4]; int ha[10]; int main() { string a, b, c, d; cin >> a >> b >> c >> d; int a1 = (int)a.length() - 2, b1 = (int)b.length() - 2, c1 = (int)c.length() - 2, d1 = (int)d.length() - 2; bool aa1 = (a1 / 2 >= b1 && a1 / 2 >= c1 && a1 / 2 >= d1) || ...
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 python # -*- coding: utf-8 -*- #int(raw_input()) #map(int, raw_input().split()) l = [] for i in range(4): s = raw_input() l.append((len(s[2:]), s[0])) l.sort(key=lambda x : x[0]) choice = None if 2*l[0][0] <= l[1][0]: choice = l[0][1] if 2*l[-2][0] <= l[-1][0]: if choice is None: ...
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
x=[] for i in range(4): x.append(len(input())-2) n=0 v=0 for i in range(4): a,b=0,0 for j in range(4): if x[i]<=x[j]/2: a+=1 for j in range(4): if x[i]>=x[j]*2: b+=1 if a==3 or b==3: n+=1 v=chr(65+i) if n==1: print(v) 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; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; int n, i, j, k; vector<pair<int, int>> a(4); for (i = 0; i < 4; i++) { cin >> s; s = s.substr(2); a[i] = {s.length(), i}; } sort(a.begin(), a.end()); vector<int> ans; if (a[0].fi...
CPP
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
a = len(raw_input())-2 b = len(raw_input())-2 c = len(raw_input())-2 d = len(raw_input())-2 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 += "A" if (b >= 2*a and b >= 2*c and b >= 2*d) or (2*b <= a and 2*b <= c and 2*b <= d): ans += "B" if (c >= 2*a and c >= 2*b a...
PYTHON
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; int main() { string A, B, C, D; cin >> A >> B >> C >> D; int a = A.size() - 2, b = B.size() - 2, c = C.size() - 2, d = D.size() - 2; vector<char> ans; if ((a * 2) <= b && (a * 2) <= c && (a * 2) <= d) ans.push_back('A'); else if ((a / 2) >= b && (a / 2) >= 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> const int INF = 1000000010; using namespace std; FILE *debug; void setIO(string file) {} void closeIO() {} template <class T> void read(T &x) { char tmp = 0; T flag = 1, ret = 0; while (tmp != '-' && !isdigit(tmp)) tmp = getchar(); if (tmp == '-') flag = -1, tmp = getchar(); while (is...
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 meow, k = 0; string s[4]; for (int i = 0; i < 4; i++) cin >> s[i]; for (int i = 0; i < 4; i++) { int n1 = 0, n2 = 0; for (int j = 0; j < 4; j++) { if (j == i) continue; n1 += (((s[i].size() - 2) * 2) <= (s[j].size() - 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; int main() { string s; vector<pair<int, int> > st; for (int i = 0; i < 4; i++) { cin >> s; st.push_back(make_pair(s.length() - 2, i)); } sort(st.begin(), st.end()); vector<int> res; bool b = 1; for (int i = 0; i < 3; i++) { if (st[i].first * 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.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; 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
lis=[] ans=['A','B','C','D'] for i in range(4): lis.append(len(raw_input())-2) an=sorted(lis[:]) mi=0 ma=0 if 2*an[0]<=an[1]: mi=1 if 2*an[2]<=an[3]: ma=1 if mi==0 and ma==0: print 'C' elif mi==1 and ma==1: print 'C' elif mi==1: for i in range(4): if lis[i]==an[0]: 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.*; import java.io.*; public class a { public static void main(String[] args) throws IOException { input.init(System.in); int[] data = new int[4]; for(int i = 0; i<4; i++) data[i] = input.next().length() - 2; int count = 0; int x = 0; for(int i = 0; i<4; i++) { int ma...
JAVA
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
//template import java.util.*; import java.util.stream.*; import java.io.*; public class Main{ static BufferedReader in= new BufferedReader(new InputStreamReader(System.in)); static PrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); private static final int HUNDRED = 100; p...
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 = sorted(list(enumerate([len(raw_input())-2 for x in xrange(4)])),key=lambda x:x[1]) minGreat = all([(arr[0][1] * 2 <= x[1]) for x in arr[1:4]]) maxGreat = all([(2 * x[1]<=arr[3][1]) for x in arr[:3]]) if minGreat and maxGreat or (not minGreat and not maxGreat): print 'C' elif maxGreat: print ['A','B','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 = [] for i in range(4): a.append(len(input()) - 2) ans = list("ABCD") tosc = '' for i in range(4): ok1 = 1; ok2 = 1; for j in range(4): if i == j: continue; if a[i] < 2 * a[j]: ok1 = 0 if a[i] * 2 > a[j]: ok2 = 0 if any((ok1, ok2)):...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
import sys import math import itertools import collections def getdict(n): d = {} if type(n) is list or type(n) is str: for i in n: if i in d: d[i] += 1 else: d[i] = 1 else: for i in range(n): t = ii() if t in d...
PYTHON3
437_A. The Child and Homework
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chi...
2
7
#include <bits/stdc++.h> using namespace std; struct number { int sz; char s; }; bool cmp(struct number a, struct number b) { return a.sz < b.sz; } int main() { char a[105], b[105], c[105], d[105]; struct number num[5]; int i; while (scanf("%s%s%s%s", a, b, c, d) != EOF) { num[0].sz = strlen(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 = len(str(input())[2:]) b = len(str(input())[2:]) c = len(str(input())[2:]) d = len(str(input())[2:]) cnt = 0 ans = "C" if 2 * a <= min(b, c, d) or a >= 2 * max(b, c, d): cnt += 1 ans = "A" if 2 * b <= min(a, c, d) or b >= 2 * max(a, c, d): cnt += 1 ans = "B" if 2 * c <= min(a, b, d) or c >= 2 * max(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() { string x; int des[4]; vector<char> ans; bool check; for (int i = 0; i < 4; i++) { cin >> x; des[i] = x.size() - 2; } for (int i = 0; i < 4; i++) { check = false; for (int l = 0; l < 4; l++) { if ((double)des[i] / des[l] > 0.5...
CPP