题意:给定a,b,每个单位时间可以将a,b中一台加1,一台减2,求最久可以支持多久。

#include <cstdio>
#include <algorithm>
using namespace std;

const int N=256;

int n1,n2;
int cnt;

int main(void)
{
    scanf("%d%d",&n1,&n2);
    while (n1>0&&n2>0)
    {
        if (n1<n2) swap(n1,n2);
        n1-=2,n2++;
        if (n1>=0&&n2>=0) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

【CodeForces 651A】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 651A Joysticks【贪心】

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

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

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

  5. Codeforces 389B(十字模拟)

    Fox and Cross Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submi ...

  6. codeforces 591B Rebranding (模拟)

    Rebranding Problem Description The name of one small but proud corporation consists of n lowercase E ...

  7. Codeforces 626B Cards(模拟+规律)

    B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input outp ...

  8. Codeforces 631C. Report 模拟

    C. Report time limit per test:2 seconds memory limit per test:256 megabytes input:standard input out ...

  9. Codeforces 679B. Barnicle 模拟

    B. Barnicle time limit per test: 1 second memory limit per test :256 megabytes input: standard input ...

随机推荐

  1. apache commons Java包简介

    更多信息,请参考:http://commons.apache.org/ 一.Commons BeanUtils说明:针对Bean的一个工具集.由于Bean往往是有一堆get和set组成,所以BeanU ...

  2. ContentProvider官方教程(9)定义一个provider完整示例:实现方法,定义权限等

    Creating a Content Provider In this document Designing Data Storage Designing Content URIs Implement ...

  3. Cheatsheet: 2013 07.09 ~ 07.20

    Mobile How to implement Android Splash Screen Migrating iOS MVC Applications to Windows Phone 8 (M-V ...

  4. linux下inotify的使用

    有时候我们需要检测某个目录下文件或者子目录的改动状况,如添加.删除.以及更新等,Linux系统上提供了inotify来完成这个功能.inotify是在版本2.6.13的内核中首次出现,现在的发行本应该 ...

  5. C#四则运算之策略模式

    Calculator.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; ...

  6. [SAP ABAP开发技术总结]预定义(内置)数据类型

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  7. poj 2954 Triangle(Pick定理)

    链接:http://poj.org/problem?id=2954 Triangle Time Limit: 1000MS   Memory Limit: 65536K Total Submissio ...

  8. php xml 操作。

    参考 文章:http://www.cnblogs.com/zcy_soft/archive/2011/01/26/1945482.html DOMDocument相关的内容. 属性: Attribut ...

  9. Codeforces Round #199 (Div. 2)

    A.Xenia and Divisors 题意:给定N个数,每个数的取值范围为1-7,N是3的倍数,判定是否能够恰好将N个数分成若干三元组,使得一个组中的元素a,b,c满足 a < b < ...

  10. SAP FI/CO凭证不一致的解决办法

    First, use program RKACOR20 to delete the incorrect CO documents. OKBA - Transfer FI Documents to CO ...