CodeForces
来源:互联网 发布:人机料法环测测知什么 编辑:程序博客网 时间:2024/06/05 05:00
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.
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
代码:
#include <iostream>#include<cstdio>#include<cstring>#include<vector>#include<queue>using namespace std;int n,m;int main(){cin>>n>>m;int k=1;while(1){ if(n>=k)n=n-k;else {cout<<"Vladik"<<endl;break;} k++; if(m>=k)m=m-k;else {cout<<"Valera"<<endl;break;} k++;} return 0;}
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- 【2017多校】HDU6092 Rikka with Subset 【DP】
- 探秘Java中String、StringBuilder以及StringBuffer
- css系列教程1-选择器全解
- 计算n的阶乘后0的个数
- 慕课网学习Java入门第三季笔记
- CodeForces
- PyQt4编程之自定义插槽
- linux启动流程图
- [第六季]5.文档元素的隐藏与显示
- 几句话解释配置./configure --prefix的作用
- P1379 八数码难题
- CF798D:Mike and distribution(思维 )^
- Trip
- (转载)spring3和spring4的一些需要注意的地方