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

合规批量下载美国上市公司年报数据的一些经验和总结 本文总结了使用Python脚本批量下载和处理美国上市公司SEC报告的技术经验。通过CIK代码查询SEC EDGAR系统,生成特定日期和报告类型的URL,并使用Selenium和Requests库下载报告内容。流程包括数据获取、文件下载、Excel处理和多线程优化,确保高效处理几百条数据。关键技术挑战包括SEC访问限制、动态网页内容和数据完整性,解决方案包括设置合规的User-Agent、使用Selenium模拟浏览器行为以及错误日志记录。最佳实践包括模块化设计、多线程优化和严格遵守SEC合规性。该自动化流程 阅读详情

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;
}


七天征服AutoSAR/SomeIP_04理解SoAD_LdCom_SD模块 本文深入解析了AUTOSAR平台下SOME/IP协议栈的架构设计与模块交互逻辑。重点剖析了SD模块(服务发现)和LdCom模块(通信适配层)与SoAD(Socket适配层)之间的复杂关联关系。文章通过详细配置表格和代码示例,阐述了服务注册发现机制、PDU路由控制策略、数据收发流程等核心功能,并形象地将三模块关系类比为"三极管结构"。特别强调了SD模块通过RoutingGroup实现通信路径的动态开关控制,以及LdCom模块在协议栈中的透传转发作用,帮助开发者理解配置规则背后的底层原理,提 阅读详情

相关推荐

用FPGA控制步进电机是种什么体验?从状态机到分频器,详解Verilog驱动A4988全流程

本文详细介绍了如何使用FPGA通过Verilog语言控制步进电机,从状态机设计到A4988驱动模块的精准控制全流程。FPGA的并行处理能力和纳秒级响应速度使其在步进电机控制中展现出显著优势,特别适合工业自动化和精密仪器应用。通过实战代码示例,展示了如何实现高效的状态机设计和可编程分频器,为开发者提供了一套完整的FPGA驱动步进电机解决方案。

weixin_30983965的博客 329

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

DeepSeek研发的精算大模型「精卫」已实现98%精算任务覆盖,中国人寿采用后年节约3.2亿元技术采购成本,形成关键技术替代效应

根据现有资料,精算领域关键技术替代效应的行业标准定义尚未明确具体提及。然而,可以从相关文献中提取一些关键概念和方法来推导出可能的定义。​替代效应的基本定义​:替代效应是指一种商品价格变动引起另一种商品的相对价格变动,从而导致消费者在维持原有效用水平不变的条件下对商品需求量做出的调整。​技术替代效应​:在精算领域,技术替代效应可以理解为新技术或新方法对现有技术或方法的替代,从而影响精算模型、数据处理和决策过程。例如,机器学习在精算中的应用日益增长,改变了精算师的工作方式和模型构建方法。​。

百态·数智思维 | 聚焦大数据、量化与未来AI 1712

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

海思方案定制hi3531dv200/SS528 DVR方案解析:从硬件选型到编解码实战应用

海思方案,Hi3518EV100,Hi3518CV100,Hi3515CV100,Hi3516CV100,Hi3516ECV100,Hi3516D,Hi3516A,Hi3519,Hi3520D,Hi3521A,Hi3535,Hi3531,Hi3536,Hi3536C,Hi3536D,Hi3518EV200,Hi3518EV201,Hi3520DV200,Hi3516CV200,Hi3516CV300,Hi3516AV200,Hi3520DV300,Hi3519V101,sd3403,hi3519av200

1585

西南交通大学车辆工程专业大四上车辆综合实训ame仿真部分

西南交通大学车辆工程专业大四上车辆综合实训ame仿真建模部分

qq_64814052的博客 1245

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

长短期记忆网络(LSTM)预测模型及其Python和MATLAB实现

LSTM 通过独特的门控机制解决了传统 RNN 的梯度消失和梯度爆炸问题,使其在处理长序列时具有显著优势。随着技术的不断发展,LSTM 及其变种(如 Bi-directional LSTM、Stacked LSTM 等)有望在更复杂的任务中发挥重要作用。2. **可视化真实值和预测值**:通过绘图来比较真实值和预测值,判断模型的准确性。2. **输入门(Input gate)**:决定当前的输入信息对细胞状态的影响。1. **细胞状态(Cell state)**:保持信息在时间步之间的传递。

qq_45441438的博客 2055

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

RK3588 Android12 添加HDMI和喇叭声音通道切换选项

rk3588 android12系统默认接hdmi out时,声音会切换到hdmi out输出,主板声卡喇叭输出会没有声音输出。现在添加一个选项设置hdmi out时,声音可以保持主板声卡喇叭输出。

Android系统开发笔记 4163

Android SurfaceFlinger——概述(一)

对于系统渲染流程的理解是指导 SurfaceFlinger 设计的核心思想,从 Android 4.1 一直到 Android 9.0 都没有太大的变化。只要抓住这五个核心思想,我们阅读 SurfaceFlinger 的难度就会下降不少。下面看一下 SurfaceFlinger 的体系和 Skia 以及 View的绘制流程的关系。framework 面向开发者所有的 View 是便于开发的控件,里面仅仅只是提供了当前 View 各种属性以及功能。

小旭的专栏 2584

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

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

一只冰熊 1871

【原理图PCB专题】Cadence 17.4版本导出excel版本坐标文件

Cadence 17.4版本导出坐标文件往往都是txt格式,并且无标题、导出时间、导出设计工程多名称等信息。那么怎么样才能导出有带这些信息的excel版本并格式好看的坐标文件呢?

一点硬件 2763

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

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

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

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

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

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

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、付费专栏及课程。

余额充值