A. Vladik and Courtesy

本文描述了一场有趣的糖果交换竞赛:参与者Vladik和Valera轮流互相给予糖果,每次比上次多一个,直到一方无法继续。文章提供了示例输入输出,并附带了一个简单的C++实现代码。

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 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:



很水的一道题,给出 a和 b现在由的糖果数量,a先扔出去1个,b扔出去2个,a扔出去3个,依次,问谁到最后手里的糖果不够扔出去的?


//1
#if 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
	
	int a,b;
	cin>>a>>b;
	
	for(int i=1; ; i++)
	{
		if(i%2==1)
		{
			a-=i;
		}
		else
		{
			b-=i;
		}
		if(a<0)
		{
			cout<<"Vladik"<<endl;
			break;
		}
		
		if(b<0)
		{
			cout<<"Valera"<<endl;
			break;
		}
		
	}
	
}

#endif

                
Bob is a duck. He wants to get to Alice's nest, so that those two can duck! Duck is the ultimate animal! (Image courtesy of See Bang)The journey can be represented as a straight line, consisting of n n segments. Bob is located to the left of the first segment, while Alice's nest is on the right of the last segment. Each segment has a length in meters, and also terrain type: grass, water or lava. Bob has three movement types: swimming, walking and flying. He can switch between them or change his direction at any point in time (even when he is located at a non-integer coordinate), and doing so doesn't require any extra time. Bob can swim only on the water, walk only on the grass and fly over any terrain. Flying one meter takes 1 1 second, swimming one meter takes 3 3 seconds, and finally walking one meter takes 5 5 seconds. Bob has a finite amount of energy, called stamina. Swimming and walking is relaxing for him, so he gains 1 1 stamina for every meter he walks or swims. On the other hand, flying is quite tiring, and he spends 1 1 stamina for every meter flown. Staying in place does not influence his stamina at all. Of course, his stamina can never become negative. Initially, his stamina is zero. What is the shortest possible time in which he can reach Alice's nest? 输入格式 The first line contains a single integer n n ( 1 ≤ n ≤ 1 0 5 1≤n≤10 5 ) — the number of segments of terrain. The second line contains n n integers l 1 , l 2 , … , l n l 1 ​ ,l 2 ​ ,…,l n ​ ( 1 ≤ l i ≤ 1 0 12 1≤l i ​ ≤10 12 ). The l i l i ​ represents the length of the i i -th terrain segment in meters. The third line contains a string s s consisting of n n characters "G", "W", "L", representing Grass, Water and Lava, respectively. It is guaranteed that the first segment is not Lava. 输出格式 Output a single integer t t — the minimum time Bob needs to reach Alice. 输入输出样例 输入#1 1 10 G 输出#1 30 输入#2 2 10 10 WL 输出#2 40 输入#3 2 1 2 WL 输出#3 8 输入#4 3 10 10 10 GLW 输出#4 80 说明/提示 In the first sample, Bob first walks 5 5 meters in 25 25 seconds. Then he flies the remaining 5 5 meters in 5 5 seconds. In the second sample, Bob first swims 10 10 meters in 30 30 seconds. Then he flies over the patch of lava for 10 10 seconds. In the third sample, the water pond is much smaller. Bob first swims over the water pond, taking him 3 3 seconds. However, he cannot fly over the lava just yet, as he only has one stamina while he needs two. So he swims back for half a meter, and then half a meter forward, taking him 3 3 seconds in total. Now he has 2 2 stamina, so he can spend 2 2 seconds flying over the lava. In the fourth sample, he walks for 50 50 seconds, flies for 10 10 seconds, swims for 15 15 seconds, and finally flies for 5 5 seconds.
08-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值