博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #416 (Div. 2) A. Vladik and Courtesy【思维/模拟】
阅读量:4502 次
发布时间:2019-06-08

本文共 1672 字,大约阅读时间需要 5 分钟。

A. Vladik and Courtesy
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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

 

 【题意】:看hint就懂了。

【分析】:根据天数的奇偶区分谁做东(减改天数)

【代码】:

#include
using namespace std;#define ll long long#define N 65535+10int main(){ ll a,b; while(cin>>a>>b) { for(int i=1;i<=10000007;i++) { if(i%2==1) { a -= i; if(a<0) return 0*puts("Vladik"); } else { b -= i; if(b<0) return 0*puts("Valera"); } } }}

  

转载于:https://www.cnblogs.com/Roni-i/p/8011968.html

你可能感兴趣的文章
mac 安装ant
查看>>
图层混合模式之正片叠底、滤色
查看>>
环信java后台发送消息时提示msg 应该为JSONObject 的坑
查看>>
Delphi中TStringList类常用属性方法详解
查看>>
删除centos7中自带有python2.7
查看>>
Cisco IOS Debug Command Reference Command E through H
查看>>
Python处理时间 time && datetime 模块
查看>>
sql 删除所有表
查看>>
SGU107-987654321 problem
查看>>
白帽子讲WEB安全 第五章 点击劫持(Click Jacking)
查看>>
Linq查询表达式
查看>>
Centos yum 安装 ipython
查看>>
探寻 webpack_bundle_analyzer 原理
查看>>
python list 插入元素
查看>>
python2 和 python3兼容写法
查看>>
C# Windows服务中执行死循环
查看>>
Linux下进程的创建过程分析(_do_fork do_fork详解)--Linux进程的管理与调度(八)
查看>>
Webpack4 splitChunks配置,代码分离逻辑
查看>>
Trie树详解及其应用
查看>>
第三组 通信一班 030 OSPFv2、OSPFv3综合实验
查看>>