//贪心,注意特判即可
#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. 【scapy】读取pcap

    scapy读取pcap包 假设有pcap包test.pcap,读取其中的分层流量信息 代码: import scapy_http.http try: import scapy.all as scapy ...

  2. 【linux】安装python依赖库confluent_kafka

    想跑https://github.com/ghaughian/mongo-kafka-spark/blob/master/src/pub.py这个程序,发现没有confluent_kafka库 1.p ...

  3. 【mongo】centos6.9安装mongo2.6.3

    参考:http://www.haorooms.com/post/3m 注意:centos6上就不要装mongo3了,容易出错. 1. 下载 curl -O http://downloads.mongo ...

  4. react 使用draft.js富文本编辑器

    参照网址:https://www.cnblogs.com/3body/p/6224010.html 参看网址:https://www.cnblogs.com/mosquito18/p/9787816. ...

  5. css中border画三角形

    <!doctype html><html lang="en"> <head>  <meta charset="UTF-8&quo ...

  6. python+selenium十五:CSS与Jquery

    在css中,id用#表示,class用.表示,要定位标签直接写标签名,其他属性就用[xxx='xxx'] 一.css定位 1.属性定位:可以通过任意属性定位,不局限于id.class.name.tag ...

  7. 【Vue】组件watch props属性值

    转载: https://www.cnblogs.com/mqxs/p/8972368.html #HTML <div id="example"> <p> & ...

  8. Python 读写excel类

    #-*- coding: utf8 -*- import xlrd import xlwt from Public import GlobalClass def openexcel(path): tr ...

  9. 论文阅读笔记二-ImageNet Classification with Deep Convolutional Neural Networks

    分类的数据大小:1.2million 张,包括1000个类别. 网络结构:60million个参数,650,000个神经元.网络由5层卷积层,其中由最大值池化层和三个1000输出的(与图片的类别数相同 ...

  10. 20165206 2017-2018-2 《Java程序设计》第三周学习总结

    20165206 2017-2018-2 <Java程序设计>第三周学习总结 教材学习内容总结 类:class是关键字,用来定义类. 类声明:例如class People. 对象的声明:类 ...