A. Vladik and Courtesy
来源:互联网 发布:网络用语dp什么意思 编辑:程序博客网 时间:2024/06/05 22:46
At regular competition Vladik and Valera won a andb 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 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.
Single line of input data contains two space-separated integers a, b (1 ≤ a, b ≤ 109) — number of Vladik and Valera candies respectively.
Pring a single line "Vladik’’ in case, if Vladik first who can’t give right amount of candy, or "Valera’’ otherwise.
1 1
Valera
7 6
Vladik
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
- A. Vladik and Courtesy
- A. Vladik and Courtesy
- A. Vladik and Courtesy
- Codefoces-811A Vladik and Courtesy [模拟]
- Codeforces 811A Vladik and Courtesy
- codeforces 811A Vladik and Courtesy
- Codeforces 811 A Vladik and Courtesy
- A. Vladik and Courtesy(思维题)
- Vladik and Courtesy
- Codeforces Round #416 (Div. 2) A. Vladik and Courtesy
- CodeForce 416 (Div. 2) A. Vladik and Courtesy
- #416 Div.2 A. Vladik and Courtesy-water
- Codeforces Round #416 (Div. 2) A. Vladik and Courtesy
- Codeforces Round #416 (Div. 2) A. Vladik and Courtesy
- codeforces——811A——Vladik and Courtesy
- codeforces #416 div2 811A-Vladik and Courtesy
- CodeForces 811A ——Vladik and Courtesy——暴力,模拟
- A. Vladik and flights
- Java理论与实践:正确使用volatile变量
- 572. Subtree of Another Tree
- Synchronized的个人学习总结
- 泛型
- CSU-ACM2017暑期训练12-KMP G
- A. Vladik and Courtesy
- 文本挖掘--数据文本处理-java
- SQL Server返回两个Date日期相差共多少天零多少小时零多少分钟零多少秒
- 2-8连接到LDAP
- linux安装fcitx
- 练习 3-6 修改itoa函数,使得该函数可以接收三个参数。其中,第三个参数为最小字段宽度。为了保证转换后所得的结果至少具有第三个参数指定的最小宽度,在必要时应在所得结果的左边填充一定的空格。
- linux源码安装mysql
- Camera app 分析(四)预览与滤镜
- 多线程