http://codeforces.com/contest/651/problem/A
题意,初始两个操控杆电量a1,a2
每分钟可以给其中一个充电。充电的电量+1,另一个则电量-2
电量可以超过100
任何一个秆电量=0,游戏结束
问你最多可以玩多少分钟
。。。直接模拟,。题意没读好。。。样例 1 1 的答案应该是0,我以为是1。。。。。
还有 2 1 我以为不可以。。其实是可以给第二个充电 变成 0 2
WA6
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <iostream>
using namespace std;
const double pi=acos(-1.0);
double eps=0.000001;
__int64 max(__int64 a,__int64 b)
{return a>b?a:b;}
int main()
{
__int64 n,m;
scanf("%I64d%I64d",&n,&m);
__int64 what=0;
while(1)
{
while (n>2)
{
what++;
n-=2;
m++;
}
while (m>2)
{
what++;
m-=2;
n++;
}
if (n<=2&&m<=2) break;
}
if (n==2&&m==1) what++;
if (n==2&&m==2) what++;
if (n==1&&m==2) what++;
printf("%I64d\n", what);
return 0;
}