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

基于ROS下的安卓手机图像和IMU跑ORB-SLAM3 接之前文章继续,手上没有现成的单目+IMU硬件,但是安卓手机几乎人人都有。因此,本文讲下如何用手机跑ORB-SLAM3的Mono和Mono_Inertial。 1. 手机与PC通信 基于ROS下的信息发布和订阅,手机和PC在一个局域网下进行信息(image和IMU)传输。 手机APK参考了github上的2个开源Android_Camera-IMU和android_ros_sensors,基于ros_java生成安卓APP,下载安装任一个APP到安卓手机,界面分别是这样: 手机和PC连一个无 阅读详情

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


CAN(2)-GD32 GD32中CAN的特征。 阅读详情

相关推荐

基于YOLOv5的隧道衬砌缺陷智能检测系统

计算机视觉在工程检测领域正发挥越来越重要的作用,特别是目标检测技术通过深度学习算法实现了对复杂场景的智能分析。YOLOv5作为当前主流的目标检测框架,通过改进网络结构和训练策略,可以显著提升检测精度和效率。在隧道工程领域,结合通道注意力机制和多尺度特征融合技术,能够有效解决衬砌缺陷识别中的小目标检测难题。这种AI检测系统相比传统人工判读地质雷达图像,不仅将效率提升20倍,还能将识别准确率提高到92.3%,特别适用于3cm以上结构缺陷的自动化检测。系统通过深度可分离卷积等优化,实现了模型轻量化,便于在边缘计算

weixin_29064103的博客 326

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

树莓派驱动DLPDLCR230NPEVM+framebuffer显示图片

DLPDLCR230NPEVM DLP® LightCrafter™ Display 230NP 是一个易于使用的紧凑型即插即用评估平台,适用于消费类产品、工业、医疗和物联网 (IoT) 市场中的各种超便携显示应用。此评估模块 (EVM) 采用 DLP230NP 芯片组,该芯片组由DLP230NP.23 1080p DMD、DLPC3436显示控制器和DLPA2005PMIC/LED 驱动器组成。此 EVM 外形小巧,配备生产就绪型光学引擎以及支持 18 位 RGB 并行视频接口...

L_Y000的博客 2618

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

仿真学习系列(二):ADS仿真直观理解方波与频谱分量的关系

在高速电路设计中,我们常常听到一句话:“信号其实不是电压在传输,而是频率在传播。” 这句话看似抽象,却揭示了信号世界的核心本质——任何时域波形,都可以被拆解为一系列不同频率的正弦波。 那么,一个看似简单的方波,究竟由哪些频率成分组成?为什么在示波器上,有的方波上升沿又快又“方”,而有的却“圆润”得多?这些差异背后,隐藏的正是高频分量的力量。 本文将通过使用 Keysight ADS,从零搭建仿真电路,直观地观察方波与其谐波成分之间的关系。

案例文章,高速信号 813

【自适应滤波】自适应UKF,基于新息自适应调节Q和R,场景为雷达跟踪与滤波、MATLAB实现

本文提出了一种基于新息协方差匹配的自适应UKF(CM-AUKF)算法,用于解决噪声统计未知或时变场景下的目标跟踪问题。通过实时调整过程噪声协方差Q和观测噪声协方差R,CM-AUKF显著提升了跟踪精度和稳定性。仿真结果表明,相比传统UKF,CM-AUKF在位置和速度估计误差上分别降低了约50%和30%,且无需人工调参。该算法适用于无人机导航、雷达跟踪等动态环境,MATLAB代码可直接运行复现结果。自适应曲线显示算法能有效收敛到真实噪声参数,验证了其自适应能力。

985工科博士毕业,专攻定位、导航和滤波等算法研究。从业10年,主要使用MATLAB 329

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

YOLOv8剪枝 lamp剪枝测试精度仅掉0.7个点,速度提高11.8fps!

该摘要介绍了LAMP剪枝方法的创新点和理论分析,重点突出了其最小化L2失真和分层自适应剪枝的特性。LAMP通过引入ξ变量在最坏情况下优化剪枝失真,并简化了计算过程。文章还提供了代码移植的具体步骤,包括创建compress.py文件和相关配置说明。

FJN110的博客 1113

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

在Qt中集成VTK和PCL:实现数据可视化的完整指南

在现代软件开发中,数据可视化至关重要。将VTK(Visualization Toolkit)和PCL(Point Cloud Library)集成到Qt环境里,能为开发者提供强大的可视化解决方案。本文将深入讲解如何在Qt中读取PCL文件,展示VTK模型和PCL数据,适合想要在Qt项目中实现数据可视化的开发者。

轩宇的博客 916

Vue+OpenLayers6一本通,OpenLayers6完整教程大全,OpenLayers6全知全解,OpenLayers6入门、实战、扩展进阶三合一专栏目录汇总

Gis开发入门,OpenLayers、Leaflet、Maplibre-gl和Cesiumjs地图引擎介绍以及几种地图服务vms、vmts介绍OpenLayers介绍,相比较其他地图引擎有什么优点OpenLayers7.x版本和6.x版本有什么区别,是否需要升级到OpenLayers7版本?OpenLayers6实战:OpenLayers创建自定义控件,以创建一个地图复位控件为例OpenLayers6实战,OpenLayers创建自定义鹰眼控件,自定义鹰眼控件样式,调整鹰眼控件位置、大小、文字和按钮等样式。

GIS技术方向,GIS地图技术分享(GIS入门、Openlayers教程、Leaflet教程),做最好的GIS地图开发教程。关注博主公众号:eguid 2199

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

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

一只冰熊 1871

迟滞比较器原理及计算

为什么要用迟滞比较器 在讲迟滞比较器之前,我们先看一个案例。 在产品设计中常常需要用到电机,而电机在从运转到停止过程中需要泄放能量,这种能量大部分以电压的形式反馈回电源母线(Vbus)导致Vbus母线电压升高,特别是功率大又转速快的电机需要急刹时,产生的反馈电压更高,严重时可能导致母线上其他器件的损坏。 为了防止将电机反馈的能量泄放掉,我们需要设计一个电路来检测母线电压,当母线电压高于某一安全阈值时,打开MOSFET Q1将母线上的能量通过电阻R5以热的形式消耗掉。 假如用一般的比较器,设计如下: Vbu

sinat_15677011的博客 2万+

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新版免狗免安祖昂绿色软件。,新界面,新视觉,

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

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

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

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

温度PID控制PLC程序

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

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

余额充值