A. The Child and Homework

Posted towerbird

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A. The Child and Homework相关的知识,希望对你有一定的参考价值。

 

http://codeforces.com/contest/437/problem/A

 

 1 import java.util.ArrayList;
 2 import java.util.Scanner;
 3 
 4 public class Main 
 5 
 6     public static void main(String[] args) 
 7         Scanner in = new Scanner(System.in);
 8         while (in.hasNext())
 9             int[]len=new int[4];
10             int[]min=new int[4];
11             int[]max=new int[4];
12             for (int i = 0; i < 4; i++) 
13                 String s=in.nextLine();
14                 while (s.length()==0)s=in.nextLine();
15                 len[i]=s.length()-2;
16             
17             for (int i = 0; i < 4; i++) 
18                 for (int j = 0; j < 4; j++) 
19                     if (j==i)continue;
20                     if (len[j]>=len[i]*2)min[i]++;
21                     if (len[j]*2<=len[i])max[i]++;
22                 
23             
24             ArrayList<Integer>al=new ArrayList<>();
25             for (int i = 0; i < 4; i++) if (min[i]==3||max[i]==3)al.add(i);
26             if (al.size()!=1) System.out.println("C");
27             else System.out.println((char)(al.get(0)+‘A‘));
28         
29     
30 

 

以上是关于A. The Child and Homework的主要内容,如果未能解决你的问题,请参考以下文章

438D - The Child and Sequence

D. The Child and Zoo

CF438D The Child and Sequence

CF(438D) The Child and Sequence(线段树)

Codeforces 438D The Child and Sequence

CodeForces 437B The Child and Set