B. Painting Eggs

http://codeforces.com/contest/282/problem/B

很水的题呀,结果比赛时没有想出来

直接上代码:

#include<iostream>

#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#include<set>

#include<map>

#include<string>

#include<queue>

#include<stack>

#include <iomanip>

using namespace std;

#define LL long long

#define ULL unsigned long long

const double eps=1e-6;

const int INF=0x3f3f3f3f;

int main()

{

    //freopen("data.in","r",stdin);

    int n;

    while(cin>>n)

    {

        int a,b,A=0,B=0;

        while(n--)

        {

            cin>>a>>b;

            if(abs(A+a-B)<=500)

            {cout<<"A";A+=a;}

            else

            {cout<<"G";B+=b;}

        }

        cout<<endl;

    }



    return 0;

}

  

你可能感兴趣的:(paint)