zoukankan      html  css  js  c++  java
  • Round #454(Div 2)

    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
    50 30 10 10
    output
    50
    30
    10
     
    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.

     :给出熊爸爸、熊妈妈、熊孩子,和玛莎的size

    要求根据他们的size设计三辆车,大小符合他们每个人的要求,既符合要求后,他们就会喜欢这辆车

    熊爸爸、熊妈妈的车只要比他们自己的size大就好,然后就是玛莎和熊孩子因为两个人喜欢一种车,所以这辆车要满足他们两个人的要求

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int V1,V2,V3,Vm;
        cin >> V1 >> V2 >> V3 >> Vm;
        if(max(V3,Vm)>2*min(V3,Vm)){
            cout << -1 << "
    ";
            return 0;
        }
        if(Vm >= V2){
            cout << -1 << "
    ";
            return 0;
        }
        if(Vm >= V1){
            cout << -1 << "
    ";
            return 0;
        }
        cout << 2*V1 << "
    " << 2*V2 << "
    " << 2*min(V3,Vm) << "
    ";
    }
  • 相关阅读:
    文件传输基础——Java IO流
    Oracle数据库之PL/SQL基础
    Oracle数据库之SQL基础(二)
    Oracle数据库之SQL基础(一)
    jQuery基础修炼圣典—DOM篇(二)jQuery遍历
    jQuery基础修炼圣典—DOM篇(一)
    Java静态代码分析工具——FindBugs插件的安装与使用
    javascript:void(0)和javascript:;的用法
    MySQL之数据类型与操作数据表
    Java数据库连接——JDBC调用存储过程,事务管理和高级应用
  • 原文地址:https://www.cnblogs.com/z-712/p/8134009.html
Copyright © 2011-2022 走看看