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 a, b (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:

题意就是两个人依次拿出多于上一个人的糖。

代码1:

#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
int num1,num2;
while(~scanf("%d%d",&n,&m)){
num1=;num2=;
int t=n;
for(int i=;i<=t;i=i+){
if(n>=i+){
  num1++;
  n=n-(i+);
}
if(m>=i+){
  num2++;
   m=m-(+i);
}
}
//cout<<num1<<" "<<num2<<endl;
if(num1<=num2) printf("Vladik\n");
else printf("Valera\n");
}
return ;
}

代码2:

#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
int num1,num2;
while(~scanf("%d%d",&n,&m)){
num1=;num2=;
int t=n;
for(int i=;i<=t;i++){ //我一开始写的i=0;i<=n,n会变的。
if(n>=*i-){
num1++;
n-=*i-;
}
if(m>=*i){
num2++;
m-=*i;
}
}
if(num1<=num2) printf("Vladik\n");
else printf("Valera\n");
}
return ;
}

Codeforces Round #416(Div. 2)-811A.。。。 811B.。。。 811C.dp。。。不会的更多相关文章

  1. Codeforces Round #174 (Div. 1) B. Cow Program(dp + 记忆化)

    题目链接:http://codeforces.com/contest/283/problem/B 思路: dp[now][flag]表示现在在位置now,flag表示是接下来要做的步骤,然后根据题意记 ...

  2. Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)

    A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...

  3. Codeforces Round#416 Div.2

    A. Vladik and Courtesy 题面 At regular competition Vladik and Valera won a and b candies respectively. ...

  4. Codeforces Round #416 (Div. 2) C. Vladik and Memorable Trip

    http://codeforces.com/contest/811/problem/C 题意: 给出一行序列,现在要选出一些区间来(不必全部选完),但是相同的数必须出现在同一个区间中,也就是说该数要么 ...

  5. Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game

    地址:http://codeforces.com/contest/811/problem/D 题目: D. Vladik and Favorite Game time limit per test 2 ...

  6. Codeforces Round #416 (Div. 2) A+B

    A. Vladik and Courtesy 2 seconds 256 megabytes   At regular competition Vladik and Valera won a and  ...

  7. Codeforces Round #416 (Div. 2) B. Vladik and Complicated Book

    B. Vladik and Complicated Book time limit per test 2 seconds memory limit per test 256 megabytes inp ...

  8. Codeforces Round #416 (Div. 2)A B C 水 暴力 dp

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

  9. 【分类讨论】【spfa】【BFS】Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game

    那个人第一步肯定要么能向下走,要么能向右走.于是一定可以判断出上下是否对调,或者左右是否对调. 然后他往这个方向再走一走就能发现一定可以再往旁边走,此时就可以判断出另一个方向是否对调. 都判断出来以后 ...

随机推荐

  1. 迷宫问题 Maze 4X4 (sloved by backtrack)

    Description 给定一个N*N的迷宫中,(0,0)为起始点,(N-1,N-1)为目的地,求可通往目的地的多个解 思路 这道题其实就是简单的DFS,一路探索到底,没路就回溯到交叉口. #incl ...

  2. KVM 初探

    KVM 是业界最为流行的 Hypervisor,全称是 Kernel-based Virtual Machine.它是作为 Linux kernel 中的一个内核模块而存在,模块名为 kvm.ko,也 ...

  3. html5 canvas画布尺寸与显示尺寸

    我在用canvas制作画板时,遇到了绘图位置和鼠标位置不一致的问题,所以今天查阅了一下资料,解决了这个问题. canvas绘图原理 在Canvas元素的内部存在一个名为2d渲染环境(2d rederi ...

  4. 学习rollup.js模块文件打包

    学习rollup.js模块文件打包 一:rollup 是什么?Rollup 是一个 JavaScript 模块打包器,可以将小块代码编译成大块复杂的代码. webpack 和 Rollup 对比不同点 ...

  5. qt中线程的使用方法

    QT中使用线程可以提高工作效率. 要使用线程要经过一下四个步骤: (1)先创建一个c++ class文件,记得继承Thread,创建步骤如下: a.第一步 b.第二步 (2)自定义一个run函数,以后 ...

  6. 在win7下用net命令无法实现对用户的创建(未完成)

    ============================================================================================= 201307 ...

  7. MIG IP控制DDR3读写测试

    本文设计思想采用明德扬至简设计法.在高速信号处理场合下,很短时间内就要缓存大量的数据,这时片内存储资源已经远远不够了.DDR SDRAM因其极高的性价比几乎是每一款中高档FPGA开发板的首选外部存储芯 ...

  8. JDK动态代理[4]----ProxyGenerator生成代理类的字节码文件解析

    通过前面几篇的分析,我们知道代理类是通过Proxy类的ProxyClassFactory工厂生成的,这个工厂类会去调用ProxyGenerator类的generateProxyClass()方法来生成 ...

  9. Maven打包排除某个资源或者目录

    最近在spark streaming本地调试的时候,引入了一些资源文件,打包的时候需要给排除掉.所以就考虑使用maven的方式 详细参考官方文档:https://maven.apache.org/pl ...

  10. NET控件Designer架构设计

    总体结构 Designer总体上由三大部分组成:View,ViewModel和Model,这个结构借鉴了流行的MVVM模式.这三部分的职责分工是: View 负责把ViewModel以图形的方式展现出 ...