Codeforces 811A Vladik and Courtesy

来源:互联网 发布:妇幼保健网络信息系统 编辑:程序博客网 时间:2024/05/18 03:11

打了场比赛涨了一百多rating,开心~虽然一共做出来两个题。。。整理一下。


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 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<cstdio>#include<cstring>#include<string>#include<algorithm>#include<iostream>#include<cmath>#include<cstdlib>#include<ctime>using namespace std;int main(){int a,b,i=0;scanf("%d%d",&a,&b);while (a>=0 && b>=0){i++;if (i%2==0){b=b-i;}else{a=a-i;}}if (i%2==0){cout<<"Valera";}else{cout<<"Vladik";}    return 0;}

不需要任何智商。。。但是需要一点细节。。。又一次犯了上一个blog的问题:计数器没清零。好在错在pretest上,没扣分。