Codeforces Round #454 A. Masha and Bears

激光雷达的64线,32线,16线,你弄懂了吗? 激光雷达的 64 线、32 线、16 线是指激光雷达系统中能够同时发射和接收激光脉冲的激光线的数量5。 阅读详情

题目链接:http://codeforces.com/contest/907/problem/A

A. Masha and Bears
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larger than the middle car, and the middle car is strictly larger than the smallest car.

Masha came to test these cars. She could climb into all cars, but she liked only the smallest car.

It's known that a character with size a can climb into some car with size b if and only if a ≤ b, he or she likes it if and only if he can climb into this car and 2a ≥ b.

You are given sizes of bears and Masha. Find out some possible integer non-negative sizes of cars.

Input

You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3.

Output

Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively.

If there are multiple possible solutions, print any.

If there is no solution, print "-1" (without quotes).

Examples
Input
Copy
50 30 10 10
Output
Copy
50
30
10
Input
Copy
100 50 10 21
Output
Copy
-1
Note

In first test case all conditions for cars' sizes are satisfied.

In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20.

题目大意:

给你4个尺寸,分别是熊爸,熊妈,熊儿子,和masha的。然后让你给出3辆车的尺寸。这三辆车严格递减,分别是让熊爸,熊妈和熊儿子坐的并且masha喜欢做最小的内辆车。假设车的尺寸是b,那么a喜欢尺寸为b的车的条件是a<=b并且2*a>=b.注意不能让masha喜欢上中等及以上尺寸的车。

思路:

要想让masha能够坐进最小的车,那么最小车的尺寸b就必须大于等于masha 的尺寸a1,并且2*a1>=b.同时还需要保证b大于等于熊儿子的尺寸a2,同时2*a2>=b.最后还需要保证中等车的尺寸B满足B>2*a2.于是就转换成熊妈妈的尺寸a3>a2.以上条件不满足就输出-1

#include<string.h>
#include<iostream>
#include<algorithm>
#include<stdio.h>
#define ll long long
using namespace std;
int  main()
{
    int v1,v2,v3,v4;
    cin>>v1>>v2>>v3>>v4;
    if(v3*2<v4||v3>2*v4||v4>=v2)
    {
        cout<<-1<<endl;
    }
    else
    {
        if(v3>v4)
        {
            cout<<2*v1<<endl;
            cout<<2*v2<<endl;
            cout<<v3<<endl;
        }
        else
        {
            cout<<2*v1<<endl;
            cout<<2*v2<<endl;
            cout<<v4<<endl;
        }

    }
    return 0;
}
另外,这场的题意是真的有点坑。。。
第一节:初识n8n与下一代工作流自动化 本章介绍了n8n的Fair-code理念与节点式架构,对比了其与Zapier/Make的核心差异,并引导读者在n8n Cloud上完成首次界面导览,建立了工作流自动化的宏观认知。 阅读详情

相关推荐

NPU、CPU和GPU

NPU、CPU和GPU是三种不同类型的处理器,它们各自有不同的设计特点和应用场景。NPU(Neural Processing Unit,神经网络处理单元)是一种专门为加速神经网络计算而设计的处理器。

m0_60697583的博客 1764

Codeforces Round #407 (Div. 2) B. Masha and geometric depression

B. Masha and geometric depression time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Masha really loves algebra

Accepted ALL lve 680

CTF逆向实战:如何快速识别RC4、TEA和Base64的魔改变种?

本文针对CTF逆向比赛中常见的加密算法魔改问题,详细讲解了如何快速识别和破解RC4、TEA和Base64的变种。通过分析算法核心特征、常见魔改手法,并结合动态调试与脚本编写等实战技巧,帮助逆向分析人员有效应对算法混淆,提升解题效率。

agile9scrum的博客 789

9anchor

CoordinatorLayout还提供了一种布局方式叫anchor,看下边效果对应xml <android.support.design.widget.FloatingActionButton android:id="@+id/fab" app:layout_anchor="@id/appbar" app:layout_anchorGravit

litefish的专栏 1597

手把手复现金蝶云星空V8.1文件上传漏洞(附完整POC与修复方案)

本文深度解析金蝶云星空V8.1文件上传漏洞,提供详细的漏洞复现步骤与完整POC,涵盖技术原理、测试环境搭建及验证流程。同时给出多维防护方案,包括官方补丁部署、临时缓解措施和长期安全加固建议,帮助企业有效防范任意文件上传风险。

weixin_30505225的博客 187

【Telephony】Telephony总纲!Phone进程流程(AOSP)

整个Framework层的Telephony框架运行在一个叫做Phone(com.android.phone)的进程中。 Phone进程启动的过程中,会初始化非常多的分支功能,SIM卡流程初始化就是其中之一,所以我觉得有必要写一下Phone进程的框架

weixin_44513784的博客 1984

CodeForce 907 A. Masha and Bears

A. Masha and Bears time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A family consisting of father bear, moth

DlPF_C的博客 1201

Keil5编译报错:ARM Compiler Version 5缺失的完整解决方案

本文提供了Keil5编译报错“ARM Compiler Version 5缺失”的完整解决方案。详细介绍了手动安装ARM Compiler Version 5的步骤,包括下载安装包、配置编译器路径及常见问题排查,帮助开发者快速恢复老项目的编译环境。

bb456的博客 951

CF907A Masha and Bears 【思维】

【题解】CF907A Masha and Bears 【思维】

Sycamore_Ma的博客 253

YOLO11 改进、魔改|分组残差自注意力GRSA,通过分组残差优化 QKV 计算、指数空间映射优化位置偏差,在大幅降低自注意力模块参数和计算量的同时,增强特征关系与位置信息的表征能力

【摘要】研究人员提出GRSA(分组残差自注意力)机制,解决Transformer在图像超分辨率任务中效率与性能难以兼顾的问题。GRSA通过分组残差层减少自注意力参数冗余,同时采用指数空间相对位置偏差优化位置信息表征。实验表明,GRSA在降低50%参数量的同时保持模型性能,适用于目标检测和图像分割任务。在YOLO系列模型中集成GRSA可提升小目标检测精度,代码实现已开源,详细部署教程见相关视频与GitHub资源。该机制为轻量化Transformer模型提供了高效解决方案。

qq_64693987的博客 809

使用 Python 实现基于 AGA8 GERG - 2008 方程计算掺氢天然气压缩因子的示例代码

AGA8 GERG - 2008 方程是用于计算天然气混合物热力学性质的一种方法,下面是一个使用 Python 实现基于 AGA8 GERG - 2008 方程计算掺氢天然气压缩因子的示例代码。需要注意的是,AGA8 GERG - 2008 方程非常复杂,完整实现需要大量的系数和详细的计算步骤。这里我们简化了部分过程,使用CoolProp库来完成计算,因为CoolProp已经实现了 GERG - 2008 方程。

AI的内部世界的博客 892

Codeforces 454A. Little Pony and Crystal Mine

time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle once got a crystal from the Crystal Mine. A crystal of size n (n

jjs98 963

一文读懂 CST 时/频域求解器

本文系统介绍了CST Studio Suite中的关键网格技术——六面体网格、四面体网格以及TLM求解器专用的八叉树非均匀网格技术。重点阐述了六面体网格的三项核心技术:理想边界拟合(PBA)技术可精确处理曲面边界,薄片技术(TST)能高效模拟薄层结构,自适应八叉树网格实现计算资源最优分配。同时详细对比了六面体网格与四面体网格的特点及适用场景,前者适用于系统级EMC/EMI分析等时域问题,后者擅长处理复杂曲面和异质材料的频域问题。

一只豌豆象的博客 473

Codeforces Round #454 (Div. 2, based on Technocup 2018 Elimination Round 4) A - Masha and Bears

根据题意小熊和masha两人都可以坐最小的车并且喜欢。并且这masha的身材也严格小于中熊和大熊的身材,因为如果不是严格小于,中熊和大熊喜欢的车masha不可能不喜欢。在这个前提下,小熊和masha两者取大则两者都喜欢,中熊和大熊都取两倍的车#include <iostream> using namespace std; int main(){ int a,b,c,d; cin>>a

Myriad Dreamin 愿逐将属于我的奇迹 229

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

IDEA的使用指南

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

Codeforces Round #454 Div. 2 A B C (暂时)

A. Masha and bears 题意 人的体积为\(V\),车的大小为\(size\),人能钻进车的条件是\(V\leq size\),人对车满意的条件是\(2V\geq size\). 现知道 熊爸爸能钻进最大的车并且满意 熊妈妈能钻进中等的车并且满意 熊宝宝能钻进最小的车并且满意 Masha能钻进最小的车并且只对它满意 给定四人的体积(保证\(V1\gt V2\gt V3\...

ahu12345678的博客 173

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Codeforces Round #454 (Div. 2, based on Technocup 2018 Elimination Round 4) A-C

这套题有史以来做的最恶心的一套题,没有之一; A题,讲的不明不白的。到底是区间还是这4个数,没有说明白, 交了7遍 全都是WA on test 4;因为一直认为就是这4个数里面选择 ,恶心, 实际要求是在区间里选定某个值; 暴力枚举!!!!!!! A: A. Masha and Bears time limit per test 2 seconds ...

weixin_30244889的博客 179

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Masha and Bears(CodeForces 907A )

Description A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car a...

Baiyi_destroyer的博客 314

CodeForces-907A Masha and Bears(想法水题)

CodeForces-907A Masha ans Bears

Boss_Xie的博客 674

题解___CodeForces 454A___10月___个人赛

该题目为模拟题, 注意从数组首位同时进行赋值会使算法时间复杂度降低 代码: #include #include #include using namespace std; const int maxn = 101; char matrix[maxn][maxn]; int n; int main() { while(scanf("%d",&n) != EOF)

zl_130的博客 400

Codeforces 454A Little Pony and Crystal Mine

#define _CRT_SECURE_NO_WARNINGS #include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;math.h&gt; #include &lt;string&gt; #include &lt;algorithm&gt; #include &lt;vector&gt; using namespace s...

Polanwind 271

Codeforces Round #454 - Div. 1 - (A)

A. Shockers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Valentin participates in a show called "Shocker

Orz 391

【codeforces454div2】A. Masha and Bears

A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes i

Lesroad 500

Codeforces Round #259 (Div. 2) A-Little Pony and Crystal Mine

A. Little Pony and Crystal Mine time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle once got a

守护生命的绿荷的专栏 911

Codeforces Round #259(454A,454B,453A(排列组合))

1.Little Pony and Crystal Mine 题目链接: http://codeforces.com/problemset/problem/454/A 解题思路: Brief description: Draw the grid graph as the problem said. Analysis: Just a few basi

piaocoder 612

Codeforces 907A Masha and Bears

A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes i

toby的博客 688

907A - Masha and Bears

题意:真的是读的稀里糊涂的,我以为读懂了了,结果还是没有,一直不知道那个masha有什么用,我就感觉相当于小熊。 输入4个值,分别代表熊爸,熊妈,熊儿子,masha的大小,如果他们自己的尺寸=车的大小,就代表他们喜欢这辆车。 让我们求出输入三只熊喜欢车的大小,没有的话输出-1。 题解:暴力枚举,Msha的作用可能就是有个隐含条件,那就是它只喜欢最小的车,和小熊判断条件一样,但是还要判

memory_qianxiao的博客 767
上一篇: education round 20 d Magazine Ad
下一篇: Codeforces Round #454 B. Tic-Tac-Toe
sinwalker2333_
博客等级 码龄9年 0粉丝 10原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值