zoukankan      html  css  js  c++  java
  • Round #416 A. Vladik and Courtesy(Div.2)

    At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for same reason gave 3 candies to Valera in next turn.

    More formally, the guys take turns giving each other one candy more than they received in the previous turn.

    This continued until the moment when one of them couldn’t give the right amount of candy. Candies, which guys got from each other, they don’t consider as their own. You need to know, who is the first who can’t give the right amount of candy.

    Input

    Single line of input data contains two space-separated integers ab (1 ≤ a, b ≤ 109) — number of Vladik and Valera candies respectively.

    Output

    Pring a single line "Vladik’’ in case, if Vladik first who can’t give right amount of candy, or "Valera’’ otherwise.

    Examples
    input
    1 1
    output
    Valera
    input
    7 6
    output
    Vladik
    Note

    Illustration for first test case:

    Illustration for second test case:

    #include <iostream>
    #include <stdio.h>
    #include <math.h>
    using namespace std;
    
    int main(){
        int a,b,x;
        scanf("%d%d",&a,&b);
        x=sqrt(a);
        x=(x*x)+x;
        if(x<=b) printf("Vladik");
        if(x>b) printf("Valera");
        return 0;
    }
    
    #include <iostream>
    #include<cstdio>
    using namespace std;
    
    int main(){
    
        int a,b;
        scanf("%d%d",&a,&b);
        int cnt=1;
        while(a>=0&&b>=0){
            a-=cnt;
            cnt++;
            b-=cnt;
            cnt++;
        }
        if(a>=0) puts("Valera");
        else puts("Vladik");
        return 0;
    }
  • 相关阅读:
    RPC
    Memcache
    python supervisor使用
    代码规范
    值传递,引用传递
    日志文件目录
    input标签的事件汇总
    箭头函数
    JS数组reduce()方法
    关于Python变量的学习总结
  • 原文地址:https://www.cnblogs.com/z-712/p/7307713.html
Copyright © 2011-2022 走看看