Codeforces Round #250 (Div. 2) 437A The Child and Homework(模拟)

计量经济学tempdisagg的python库:年度时序变月度 阅读详情

A. The Child and Homework
time 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,题目说有确定的一个选项则输出该选项,否则输出C。


AC代码:


#include "iostream"
#include "cstdio"
#include "cstring"
#include "algorithm"
using namespace std;
struct node
{
	/* data */
	int len;
	char s[200], flag;
}a[4];
bool cmp(node a, node b)
{
	if(a.len == b.len)
		return a.flag < b.flag;
	return a.len < b.len;
}
int main(int argc, char const *argv[])
{
	for(int i = 0; i < 4; ++i) {
		scanf("%s", a[i].s);
		a[i].flag = a[i].s[0];
		a[i].len = strlen(a[i].s) - 2;
	}
	sort(a, a + 4, cmp);
	bool flag1 = false, flag2 = false;
	if(a[0].len * 2 <= a[1].len) flag1 = true;
	if(a[3].len >= a[2].len * 2) flag2 = true;	
	if((flag2 && flag1) || (!flag2 && !flag1)) printf("C\n"); 
	else if(flag1) printf("%c\n", a[0].flag);
	else if(flag2) printf("%c\n", a[3].flag);
	return 0;
}


ICP-10111气压传感器原理图设计,已量产(压力传感器) 在最近的室内导航定位项目中,我们需要一款能捕捉厘米级垂直高度变化的气压传感器 —— 毕竟室内环境里,哪怕是单个台阶的高度差都得精准识别。对比了几款器件后,最终选定了 ICP-10111:它 ±1Pa 的压差精度刚好能把高度差分辨到 8.5cm,0.4Pa 的低压力噪声能让数据输出足够稳定,再加上 0.5Pa/℃的低温漂特性,长期工作的可靠性也能满足需求。下面聊聊这套适配 ICP-10111 的硬件电路设计细节。 阅读详情

相关推荐

OpenFoam实用技巧——starccm网格高效转换openfoam格式全解析

本文详细解析了如何利用OpenFOAM官方工具`ccm26toFoam`,将STAR-CCM+生成的高质量网格高效、稳定地转换为OpenFOAM格式。内容涵盖从STAR-CCM+正确导出网格、执行转换命令、解读转换日志,到转换后关键的边界条件修复与网格质量检查等全流程,旨在帮助用户规避常见错误,实现无缝工作流衔接。

weixin_28309571的博客 457

The Child and Homework

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 de...

weixin_44824383的博客 205

LTspice 导入 PSpice 模型实战指南 --(解决语法兼容性与模型优化问题)

本文提供了将PSpice模型成功导入LTspice的详细实战指南。针对两者间的语法兼容性问题,文章以TI UCC23513为例,逐步讲解模型获取、符号创建、常见语法错误修改及仿真验证方法,并分享了模型优化与个人库管理技巧,帮助用户高效解决模型导入与仿真难题。

weixin_28278377的博客 820

CF#250 (Div. 2) A .

The Child and Homework time 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

代码艺术的道与术 817

Claude AI实战指南:从注册到精通,突破手机验证的终极解决方案

本文提供了一份详尽的Claude AI实战指南,重点解决了国内用户注册过程中的手机号验证难题,并分享了使用技巧。文章详细介绍了如何通过虚拟手机号服务等方案完成注册,并深入解析了Opus、Sonnet、Haiku三大模型的特点与选择策略,帮助用户从注册到精通,高效利用这一安全、健谈的AI助手进行内容创作、编程开发与学习研究。

weixin_29092031的博客 1229

用户和实体行为分析(UEBA)基础指南及解决方案

用户和实体行为分析(UEBA)或异常检测是一种网络安全技术,它使用机器学习(ML)算法来检测网络中用户、主机和其他实体的异常活动。

ITmoster的博客 2892

Codeforces Round #250 (Div. 2) A. The Child and Homework

A. The Child and Homework time 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 tes

flyljg的专栏 856

单反相机物镜设计[DG-10]

REAR(要打在像面,操作数要找像面对应位置15):以透镜单位表示的真实光线径向坐标,波长由Wave定义,参见“Hx、Hy、Px和Py”。最小玻璃厚度最小不能小于semi-dia的1/10,要根据layout看有没有过厚过薄,反复调节。PROD:两个操作数的乘积(操作#1 X操作#2)。3x4就是57.3x0.41=23.5。拦光一般在第一面和最后一面操作,减少边缘无用光线。光阑面与镜面贴近,要调距离,同时设置光阑像差。后截距是指从镜头后表面到焦点的距离。CONS:弧度转为角度。镜头相互嵌入,有错误。

weixin_72050316的博客 600

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) ...

ao9795的博客 201

【用unity实现100个游戏之1】制作类元气骑士、挺进地牢——俯视角射击游戏多种射击效果(一)(附源码)

俯视角射击游戏)是一类以俯视视角进行游戏展示的射击游戏。在这种游戏中,玩家控制着一个角色或载具,从俯视的角度上方观察游戏世界,并与敌人进行战斗。这种视角使玩家能够有更好的全局观察和策略性,同时也强调快速反应和精确射击。视角:俯视角度可以是固定的,也可以随着玩家角色的移动而变化,但都允许玩家以全局视角观察整个战场,有利于制定战略和规划行动。射击:玩家通常需要使用各种武器来与敌人进行战斗,包括枪械、爆炸物等。射击动作依赖于玩家的反应速度和准确性。

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 7832

【突变检验合集】含Pettitt突变检验等

突变检验方法合集

WW、forever的博客 3534

Codeforces Round #250 (Div. 2) A - The Child and Homework

传送门Codeforces Round #250 (Div. 2) A - The Child and Homework

一只冰熊 1871

YOLO 系列专栏(二十九)YOLO26 × StarNet 轻量化涨点方案(CVPR 2024)轻量化、主干改进篇 | 星星卷积虽小,却蕴藏着巨大的高效潜力

StarNet 出自 CVPR 2024 轻量化主干网络工作,核心创新是,依靠逐元素乘法实现高阶特征融合,在几乎不增加参数量与 FLOPs 的前提下,大幅提升特征表达能力,天然适合等多任务统一建模。本文将 StarNet 完整替换 YOLO26 原有主干,保留 YOLO26 无 NMS 检测头与轻量化结构,实现,并提供。

qq_36130719的博客 410

Codeforces Round #250 (Div. 1) D. The Child and Sequence(线段树+区间求模+区间查询)

先呈上原题链接[Codeforces Round #250 (Div. 1) D. The Child and Sequence] 题意: 给定一组数有三个操作: 区间每个值对P求模; 单点修改 询问区间和 思路: 两棵线段树,一个维护区间最大值,一个维护区间和。 因为求模运算每次至少是折半的,所以对需要求模的暴力修改就行了。 坑点: 无 good luck and have fun!!! 附上代...

BNUbeginner的博客 247

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

Codeforces Round #250 (Div. 2) 437C The Child and Toy(脑洞贪心)

C. The Child and Toy time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On Children's Day, the child got a toy

GKHack's Blog 1626

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Codeforces Round #250 (Div. 2) C. The Child and Toy 详解

output standard output On Children's Day, the child got a toy from Delayyy as a present. However, the child is so naughty that he can't wait to destroy the toy. The toy consists of n parts and

__ElemenT 1504

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Codeforces Round #250 (Div. 1) D. The Child and Sequence 分块

/* Codeforces Round #250 (Div. 1) D. The Child and Sequence 分块 链接:https://codeforces.com/contest/438/problem/D 题意: op 1 : 区间加 op 2 : 区间每个数取模 op 3 : 单点修改; 分块 操作1 : 区间加 完整块O(1),非完整块暴力累加即可; 操作2 : 取模 ...

布呗之路 349

Codeforces Round #250 Div. 2(C.The Child and Toy)

题目如下: C. The Child and Toy time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On Children's Day, the child

Sun_tester的专栏 1801

Codeforces Round #250 (Div. 2)——The Child and Set

给定goal和limit,求1-limit中的若干个数,每个数最多出现一次,且这些数的lowbit()值之和等于goal,如果存在这样的一些数,输出个数和每个数;否则-1

Confidence的专栏 1506

Codeforces Round #250 (Div. 1) D. The Child and Sequence

D. The Child and Sequence time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output At the children's day, the child

qqspeed 1864

Codeforces Round #250 (Div. 2)—A. The Child and Homework

好题啊,被HACK了,以前做题都是人数越来越多,这次比赛 PASS人数 从2000直掉 1000人  被HACK  1000多人!!!!没见过的科技啊 A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input

NotPerfect-EOF 1806

Codeforces Round #250 Div1A Div2C 437C The Child and Toy 贪心

这道题我在考场上并不是自己想出来的,是在别人帮助下搞懂的。

KuribohG 1016

Codeforces Round #250 (Div. 2) B. The Child and Set

B - The Child and Set 链接: B - The Child and Set. At the children’s day, the child came to Picks’s house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite set of Picks. Fortunately, Picks remem

浅蓝色の伤的博客 148
上一篇: POJ3268 Silver Cow Party(dijkstra)
下一篇: Codeforces Round #250 (Div. 2) 437C The Child and Toy(脑洞贪心)
GKHack
博客等级 码龄11年 48粉丝 291原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值