Cod sursa(job #927576)

Utilizator andreiblaj17Andrei Blaj andreiblaj17 Data 25 martie 2013 21:16:29
Problema Fructe Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream in("fructe.in");
ofstream out("fructe.out");

long long t,p,b;

void hard_work(){
    in >> t;
    for (int i=1; i<=t; i++){
        in >> p >> b;
        while(p!=0&&b!=0){
            if (p>b){
                p--;
            } else if (p<b){
                p--;
              } else if (p==b) {
                    b--;
                }
        }
        if (p==0) out << "0" << "\n";
        else if (b==0) out << "1" << "\n";
    }
}

int main()
{
    hard_work();
    return 0;
}