907A

来源:互联网 发布:淘宝自动下架的原因 编辑:程序博客网 时间:2024/06/03 21:46

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 V1V2V3Vm(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
50 30 10 10
output
503010
input
100 50 10 21
output
-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.



题意:真的是读的稀里糊涂的,我以为读懂了了,结果还是没有,一直不知道那个masha有什么用,我就感觉相当于小熊。

输入4个值,分别代表熊爸,熊妈,熊儿子,masha的大小,如果他们自己的尺寸<=一个车的大小,并且2倍他们身体的大小>=车的大小,就代表他们喜欢这辆车。

让我们求出输入三只熊喜欢车的大小,没有的话输出-1。


题解:暴力枚举,Msha的作用可能就是有个隐含条件,那就是它只喜欢最小的车,和小熊判断条件一样,但是还要判断2*d 应该小于熊妈的车,代表它不喜欢其他车,因为三辆车的大小是递减的。三层for循环,第一层找熊爸的喜欢的车,第二层找熊妈的车,第三层找小熊的,同时满足就输出车大小,循环完没有就输出-1.

#include<bits/stdc++.h>using namespace std;int main(){    int a,b,c,d;    while(cin>>a>>b>>c>>d)    {        for(int i=1; i<=200; i++)        {            for(int j=1; j<i; j++)            {                for(int k=1; k<i; k++)                {    ///判断每只熊能够进入车,并且喜欢,还要判断masha不喜欢其他车                    if(a<=i&&2*a>=i&&b<=j&&2*b>=j&&c<=k&&2*c>=k&&d<=k&&2*d>=k&&2*d<j)                    {                        printf("%d\n%d\n%d\n",i,j,k);                        return 0;                    }                }            }        }        puts("-1");    }    return 0;}


阅读全文
'); })();
0 0
原创粉丝点击
热门IT博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 平胸的女人怎么喂奶 胸平的像飞机场怎么办 平胸的图片 女生为什么平胸 平胸怎么穿婚纱 怎样可以平胸 平胸的女人 平胸穿婚纱怎么办 平胸吧 平胸性感 平胸女人照片 平胸怎么挤出胸沟 平胸少女图片 胸平 胸平胸小怎么才能大 女朋友平胸 平胸女星 平胸女人 女生完全平胸怎么办 如何变成平胸 女生平胸 平胸女人要怎么丰胸 平胸是病吗 女友平胸怎么办 女孩平胸怎么办 造成平胸的原因 如何变平胸 怎样变平胸 女孩子平胸怎么办 女孩平胸是什么原因 平胸吃什么可以丰胸 18岁胸下垂怎么办 20岁胸小怎么办 17岁平胸怎么办 我胸小怎么办 20岁女胸 20岁胸还很小怎么办 20岁平胸怎么办 二十多岁胸下垂怎么办 胸是怎么变大的 18岁胸下垂怎么矫正