Codeforces Round #250 (Div. 2)—A. The Child and Homework
好题啊,被HACK了。曾经做题都是人数越来越多。这次比赛 PASS人数 从2000直掉 1000人 被HACK 1000多人!
!
!
!
没见过的科技啊
1 2 4 8 这组数 被黑的
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.
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);}}}elseprintf("C\n");return 0;
}
Codeforces Round #250 (Div. 2)—A. The Child and Homework相关推荐
- Codeforces Round #250 (Div. 2) A - The Child and Homework
传送门Codeforces Round #250 (Div. 2) A - The Child and Homework 第一次做完之后交上去,过了例子.顺手就锁定了...然后一个小时之后就被HACK ...
- Codeforces Round #250 (Div. 1) D. The Child and Sequence 线段树 区间取摸
D. The Child and Sequence Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...
- [Codeforces Round #250 (Div. 1) -D] The Child and Sequence
Codeforces传送门 洛谷传送门 题意翻译 给定数列,区间查询和,区间取模,单点修改. n,m≤105n,m≤105n,m\le 10^5 题目描述 At the children's day, ...
- Codeforces Round 250(Div. 2)
layout: post title: Codeforces Round 250 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- Codeforces Round #250 (Div. 2) (ABCD题解)
比赛链接:http://codeforces.com/contest/437 A. The Child and Homework time limit per test:1 second memory ...
- 【Christmas Game】【CodeCraft-21 and Codeforces Round #711 (Div. 2)】【Nim-博弈】【树形DP】【拆分树】
CodeCraft-21 and Codeforces Round #711 (Div. 2) Christmas Game Nim-博弈 树形DP 拆分树 牛客链接 https://ac.nowco ...
- Educational Codeforces Round 112(Div.2) ABC题解
D题好像可以做一做,挖个坑以后做好了来填(doge Educational Codeforces Round 112(Div.2) 题目列表 1.A 2.B 3.C 1.A 原题链接 题目大意 有三种 ...
- Codeforces Round #400 (Div. 1 + Div. 2, combined) 776E. The Holmes Children(待翻译)
Codeforces Round #241 (Div. 2) 514C Watto and Mechanism ≤,≠,≥<> 时间限制:1S / 空间限制:256MB [在线测试提交传送 ...
- Codeforces Round #506 (Div. 3)
Codeforces Round #506 (Div. 3) 实习期间事不多,对div3 面向题解和数据编程了一波 A. Many Equal Substrings 题目链接 A题就是找后缀和前缀重合 ...
最新文章
- 移动端与PHP服务端接口通信流程设计(基础版)
- uboot启动第一阶段——start.S
- 如何在hexo中支持Mathjax
- java 定位打印_Java定位打印(Java location printing).doc
- Android打包使用自有证书认证
- tensorflow获取可用GPU设备
- 圣诞节即将到来让你的Mac屏幕下雪只需一招轻松解决
- DEM高程数据获取方法
- Grails4 使用Audit-Logging Stampable 出现报错:HHH000142: Bytecode enhancement failed
- 八大顶层设计,决定企业融资难度
- 在Ogre中实现Mpq文件格式的支持
- python专题知识追寻者对OS的理解
- 交换机端口mtu值最大_H3CCAS接口MTU值方法
- win7背景颜色设置为淡绿色
- linux CentOS7虚拟机修改静态ip地址
- 程序员用简单C语言一顿神操作,瞬间打造植物大战僵尸,无人不服
- HTML如何引入md5算法,MD5算法实现
- C#,基于视频的目标识别算法(Moving Object Detection)的原理、挑战及其应用
- 准备结婚的朋友好好看看!这篇文章触动了十几万人!
- php 获取agent,PHP解析HTTP_USER_AGENT 获取客户端浏览器以及版本号 | 八戒哥技术博客...