Codeforces Round #250 (Div. 2)A(英语学习)
链接:http://codeforces.com/contest/437/problem/A
1 second
256 megabytes
standard input
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?
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 "_".
Print a single line with the child's choice: "A", "B", "C" or "D" (without quotes).
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
D
A.ab
B.abcde
C.ab
D.abc
C
A.c
B.cc
C.c
D.c
B
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.
******************************************************
……………………………………………………………………………………………………………………
看了N久的题意,发现原来是英语词组不理解,英语水平太差
A twice longer than B 表示 A >= 2 * B,A twice shorter than B表示 A * 2 <= B
你知道吗???
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream> int main()
{
char str[][];
int len[];
for(int i=; i<=; i++)
{
scanf("%s",str[i]);
len[i]=strlen(str[i])-;
}
int xy=,dy=;
int flag=;
int ans=;
for(int i=; i<=; i++)
{
xy=;dy=;
for(int j=; j<=; j++)
{
if(i != j)
{
if(len[i]*<=len[j])
{
xy++;
}
if(len[i]>=len[j]*)
{
dy++;
}
}
}
if(xy> || dy>)
{
flag=i;
ans++;
//break;
}
}
if(flag && ans == )
{
printf("%c\n",flag+);
}
else if(flag == || ans != )
{
printf("C\n");
}
return ;
}
最新文章
- POJ1014 解题报告(DFS)
- 更改printk打印级别
- php 5.3开始使用mysqlnd作为的默认mysql访问驱动
- python自定义函数在Python解释器中调用
- Deployment of VC2008 apps without installing anything
- js 实现分割条
- Section 1.1 Your Ride Is Here
- JS函数的参数声明中用 var 与不用 var的区别
- Spring统一返回Json工具类,带分页信息
- 你必须知道的EntityFramework 6.x和EntityFramework Core变更追踪状态
- Error【0002】:YUM本地源配置问题
- SpringBoot技术栈搭建个人博客【后台开发】
- spring集成rabbitmq
- python 之 configparser 模块
- 4.3.6 对象的界定通过编写接口来访问带这类命名结构的表会出问题。如前所述,SQL Server的灵活性不应用作编写错误代码或创建问题对象的借口。 注意在使用Management Studio的脚本工具时,SQL Server会界定所有的对象。这不是因为这么做是必须的,也不是编写代码的最佳方式,而是因为在界定符中封装所有的对象,比编写脚本引擎来查找需要界定的对象更容易。
- 5.2 dubbo-compiler源码解析
- Nginx服务优化详解
- python pip 升级
- 使用ssm实现校验密码
- Javascript 中正则表达式验证网址