codeforces——811A——Vladik and Courtesy

来源:互联网 发布:洛奇英雄传网络单机版 编辑:程序博客网 时间:2024/06/08 18:35
A. Vladik and Courtesy
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

At regular competition Vladik and Valera won a andb candies respectively. Vladik offered1 his candy to Valera. After that Valera gave Vladik2 his candies, so that no one thought that he was less generous. Vladik for same reason gave3 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, theydon’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 a, b (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:



从1开始每次多拿一个,两个人轮换拿,谁先为负,判负


#include<iostream>#include<algorithm>#include<stdio.h>#include<cstring>#include<cmath>#include<map>using namespace std;int main(){    int qi[35001],ou[35001];    for(int i=0; i<=35000; i++)    {        qi[i]=i*i;        ou[i]=i*i+i;    }    int n,m;    while(cin>>n>>m!=NULL)    {        int i;        for(i=0;; i++)            if(qi[i+1]>n)                break;        int j;        for(j=0;; j++)            if(ou[j+1]>m)                break;        if(j>=i)            cout<<"Vladik"<<endl;        else            cout<<"Valera"<<endl;    }    return 0;}



原创粉丝点击