首页 技术 正文
技术 2022年11月17日
0 收藏 308 点赞 2,466 浏览 2659 个字

     好题啊,被HACK了。曾经做题都是人数越来越多。这次比赛 PASS人数 从2000直掉 1000人  被HACK  1000多人!

没见过的科技啊

1 2 4 8 这组数 被黑的

A. The Child and Homeworktime limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D.
Each choice has a description, and the child should find out the only one that is correct.

Fortunately the child knows how to solve such complicated test. The child will follow the algorithm:

  • If there is some choice whose description at least twice shorter than all other descriptions, or at least twice longer than all other descriptions, then the child thinks the choice is great.
  • If there is exactly one great choice then the child chooses it. Otherwise the child chooses C (the child think it is the luckiest choice).

You are given a multiple-choice questions, can you predict child’s choose?

Input

The first line starts with "A." (without quotes), then followed the description of choice A.
The next three lines contains the descriptions of the other choices in the same format. They are given in order: B, C, D. Please
note, that the description goes after prefix "X.", so the prefix mustn’t be counted in description’s length.

Each description is non-empty and consists of at most 100 characters. Each character can be either uppercase English letter or lowercase English letter, or "_".

Output

Print a single line with the child’s choice: "A", "B", "C"
or "D" (without quotes).

Sample test(s)input

A.VFleaKing_is_the_author_of_this_problem
B.Picks_is_the_author_of_this_problem
C.Picking_is_the_author_of_this_problem
D.Ftiasch_is_cute

output

D

input

A.ab
B.abcde
C.ab
D.abc

output

C

input

A.c
B.cc
C.c
D.c

output

B

Note

In the first sample, the first choice has length 39, the second one has length 35, the third one has length 37, and the last one has length 15. The choice D (length
15) is twice shorter than all other choices’, so it is great choice. There is no other great choices so the child will choose D.

In the second sample, no choice is great, so the child will choose the luckiest choice C.

In the third sample, the choice B (length 2) is twice longer than all other choices’, so it is great choice. There is no other great choices so the child will
choose B.

AC:

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
const int N = 110;
using namespace std;
char a[10][N];
int s[10];
int main()
{
for(int i = 0;i<4;i++)
{
scanf("%s",a[i]);
s[i] = strlen(a[i]);
s[i] -=2;
}
int flag = 0,flag1 = 0;
sort(s,s+4);
int ma = s[3];
int mi = s[0];
for(int i = 1;i<4;i++)
{
if(s[0]==0)
break;
if((s[i]/s[0])>=2)
{
flag++;
}
}
for(int i = 0;i<3;i++)
{
if(s[i]==0)
break;
if((s[3]/s[i])>=2)
{
flag1++; }
} if(flag1==3 && flag!=3)
{
for(int i = 0;i<4;i++)
{
int len = strlen(a[i]);
len -= 2;
if(len==ma)
{
printf("%c",'A'+i);
}
}
}
else if(flag==3 && flag1!=3)
{
for(int i = 0;i<4;i++)
{
int len = strlen(a[i]);
len -=2;
if(len==mi)
{
printf("%c",'A'+i);
}
}
}
else
printf("C\n"); return 0;
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,103
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,579
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,427
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,199
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,834
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,917