codeforces——811A——Vladik and Courtesy
来源:互联网 发布:洛奇英雄传网络单机版 编辑:程序博客网 时间:2024/06/08 18:35
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.
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:
从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;}
- codeforces——811A——Vladik and Courtesy
- CodeForces 811A ——Vladik and Courtesy——暴力,模拟
- Codeforces 811A Vladik and Courtesy
- codeforces 811A Vladik and Courtesy
- Codeforces 811 A Vladik and Courtesy
- codeforces #416 div2 811A-Vladik and Courtesy
- A. Vladik and Courtesy
- A. Vladik and Courtesy
- A. Vladik and Courtesy
- Codefoces-811A Vladik and Courtesy [模拟]
- Codeforces Round #416 (Div. 2) A. Vladik and Courtesy
- Codeforces Round #416 (Div. 2) A. Vladik and Courtesy
- Codeforces Round #416 (Div. 2) A. Vladik and Courtesy
- A. Vladik and Courtesy(思维题)
- codeforces 811D——Vladik and Favorite Game(bfs)
- Vladik and Courtesy
- CodeForce 416 (Div. 2) A. Vladik and Courtesy
- #416 Div.2 A. Vladik and Courtesy-water
- 使用plist进行页面间传值
- BZOJ4009: [HNOI2015]接水果 kdtree
- ARM裸机程序研究
- 常用正则表达式
- 利用背景图片生成词云,设置停用词词集
- codeforces——811A——Vladik and Courtesy
- 什么是redis
- 数据库事务隔离级别
- java---模块二:流程控制
- codeforces 810A Straight «A»
- java Build Path
- 外部表+创建外部表+创建外部表步骤
- Win7如何禁止用户打开U盘?Win7禁止用户打开U盘的方法
- 那些年系统开发经历的性能坑经历总结