CF-811A
A. Vladik and Courtesytime limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard 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.
InputSingle line of input data contains two space-separated integers a, b (1 ≤ a, b ≤ 109) — number of Vladik and Valera candies respectively.
OutputPring a single line "Vladik’’ in case, if Vladik first who can’t give right amount of candy, or "Valera’’ otherwise.
Examplesinput1 1outputValerainput7 6outputVladikNoteIllustration for first test case:
Illustration for second test case:
题意:
每次减数递增,求最终谁先小于0
AC代码:
#include<bits/stdc++.h>
using namespace std; int main(){
ios::sync_with_stdio(false);
int a,b;
cin>>a>>b;
int ans=,temp=;
while(a>=&&b>=){
if(ans%==){
a-=temp;
}
else{
b-=temp;
}
temp++;
ans++;
}
if(b<){
cout<<"Valera"<<endl;
}
else{
cout<<"Vladik"<<endl;
}
return ;
}
CF-811A的更多相关文章
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
- CF #374 (Div. 2) D. 贪心,优先队列或set
1.CF #374 (Div. 2) D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...
随机推荐
- create-react-app创建项目报错SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar' npm代理
SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar' 错误 ...
- python编程基础:《http://www.cnblogs.com/wiki-royzhang/category/466416.html》
windows自动化 http://www.cnblogs.com/wiki-royzhang/category/466416.html
- 如何学习CCIE
想想自己拖了这么久,也没考试,也没积极去做实验,心里也有怨念,其实一直是方法不对,今天心里产生共鸣,后悔当初太年轻. 转载地址:http://bbs.hh010.com/thread-467553-1 ...
- 九度OJ 1009:二叉搜索树 (二叉树)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6321 解决:2767 题目描述: 判断两序列是否为同一二叉搜索树序列 输入: 开始一个数n,(1<=n<=20) 表示有n个需 ...
- 九度OJ 1049:字符串去特定字符 (基础题)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8499 解决:3860 题目描述: 输入字符串s和字符c,要求去掉s中所有的c字符,并输出结果. 输入: 测试数据有多组,每组输入字符串s和 ...
- Nested Classes
http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html package priceton; /* * Copyright (c) ...
- 如何获取 Greenplum 中用户最后登录时间和登录频率
这几天搞系统迁移,老板突然想知道给客户开的那么多用户当中,哪些还在用,哪些已经不用了.我们的数据库是 Greenplum,而且还是一直没有升级的老版本,Google 了一下没有发现特别好的查看用户登录 ...
- OpenCV Machine Learning 之 正态贝叶斯分类器 (Normal Bayes Classifier)
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/zhjm07054115/article/details/27631913
- Android 虚拟机 程序安装目录
Android应用安装涉及到如下几个目录:system/app系统自带的应用程序,无法删除.data/app用户程序安装的目录,有删除权限.安装时把apk文件复制到此目录.data/data存放应用程 ...
- HTML5_CSS3仿Google Play垂直菜单
在线演示 本地下载