Codeforces 811A Vladik and Courtesy
来源:互联网 发布:妇幼保健网络信息系统 编辑:程序博客网 时间:2024/05/18 03:11
打了场比赛涨了一百多rating,开心~虽然一共做出来两个题。。。整理一下。
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
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上,没扣分。
- Codeforces 811A Vladik and Courtesy
- codeforces 811A Vladik and Courtesy
- Codeforces 811 A Vladik and Courtesy
- codeforces——811A——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
- CodeForces 811A ——Vladik and Courtesy——暴力,模拟
- A. Vladik and Courtesy(思维题)
- Vladik and Courtesy
- CodeForce 416 (Div. 2) A. Vladik and Courtesy
- #416 Div.2 A. Vladik and Courtesy-water
- 【35.02%】【codeforces 734A】Vladik and flights
- FreeMarker
- 读书笔记《Effective C++》条款37:绝不重新定义继承而来的缺省参数值
- 关系型数据库管理系统:事务处理Durability(持久性)的实现
- 采用十字链表存储的稀疏矩阵
- POJ-1426 Find The Multiple
- Codeforces 811A Vladik and Courtesy
- Linux离线安装SVN
- WebStrom快捷键
- ajax实战篇---城市select联动----XML交互
- Type mismatch: cannot convert from ComboPooledDataSource to DataSource
- 移植 bootm 命令启动内核
- Unity3D脚本18:可视化辅助设置类 Gizmos
- 图像傅里叶变换的幅度谱和相位谱的以及反变换
- Web基础知识