//贪心,注意特判即可
#include <iostream>
using namespace std;
int main()
{
int a,b,ans = ;
cin >> a >> b;
while(a+b > && (a != || b != ) && (a!= && b!=))
{
++ans;
if(a > b) {a -= ; b+=;}
else {a+=; b-=;}
}
cout << ans << endl;
return ;
}

codeforces651----A. Joysticks的更多相关文章

  1. CodeForces 651A Joysticks 贪心

    A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  2. codeforces 651A Joysticks

    A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  3. CodeForces 651 A Joysticks

    A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  4. Codeforces Round #345 (Div. 2) A. Joysticks dp

    A. Joysticks 题目连接: http://www.codeforces.com/contest/651/problem/A Description Friends are going to ...

  5. codeforces 651A A. Joysticks (模拟)

    A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  6. Codeforces Round #345 (Div. 2)——A. Joysticks(模拟+特判)

    A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  7. 【CodeForces 651A】Joysticks 模拟

    题意:给定a,b,每个单位时间可以将a,b中一台加1,一台减2,求最久可以支持多久. #include <cstdio> #include <algorithm> using ...

  8. Codeforces 651A Joysticks【贪心】

    题意: 两根操纵杆,每分钟操纵杆消耗电量2%,每分钟又可以给一个操纵杆充电1%(电量可以超过100%),当任何一个操纵杆电量降到0时,游戏停止.问最长游戏时间. 分析: 贪心,每次选择电量剩余最少的充 ...

  9. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

随机推荐

  1. bzoj 3529

    非常好的一道莫比乌斯反演题,对提升自己的能力有很大帮助. 首先我们分析一下题意:题意让我们求,其中 那么我们首先对后面的式子进行一下变形,变形过程详见https://blog.csdn.net/lle ...

  2. CF1005F

    这题不错... 首先,不难看到他想让你求出的是最短路树 然后,考虑到所有边权均为1,所以可以采用bfs直接生成最短路树 至于方案的储存,可以在加边的时候同时记录边的编号,然后对每个点维护一个能转移他的 ...

  3. jenkins 回滚发布

    #jenkins拉取文件路径 workspace=/data/wos/testtemp #备份路径 backspace=/data/wos/back #不能提Git的文件 config=/data/w ...

  4. Ubuntu点击dash home就崩溃

    很崩溃的一个问题,搞了好久.并没有很清楚的知道具体哪个细节导致的问题,只是大概知道了原因,以及搞出了一个解决方案. 问题描述 台式机,没有独立显卡,也就是只有一个intel CPU在一起的小破显卡(我 ...

  5. org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /eclipse20171118

    1:如果有一天,你有幸看到了这个错误,也许你像我一样low,因为此时,你已经准备开发Zookeeper程序了,却还没有把Zookeeper的服务启动起来. org.apache.zookeeper.K ...

  6. Tomcat模型结构

    一.请求过程 Tomca的两大组件:Connecter和Container Connecter组件 1.Connecter将在某个指定的端口上侦听客户请求,接收浏览器的发过来的 tcp 连接请求,创建 ...

  7. table无法控制宽度

    table-layout:fixed

  8. python之集合set

    1.测试 # python2和python3方法列表相同 ops23 = ['add', 'clear', 'copy', 'difference', 'difference_update', 'di ...

  9. Js计算时间差,天数,小时数,余数

    var begintime_ms = Date.parse(new Date(begintime.replace(/-/g, "/"))); //begintime 为开始时间 v ...

  10. ps命令显示uid而不是用户名的解决方法