Cod sursa(job #876654)

Utilizator IronKingqwerty xxx IronKing Data 11 februarie 2013 23:15:44
Problema Fructe Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include <fstream>
using namespace std;
ifstream f("fructe.in");
ofstream g("fructe.out");
int n,p,b,i;
int main ()
{
  f>>n;
  for (i=1;i<=n;i++)
  {
    f>>p>>b;
    if (p==b)
    {
      g<<1<<'\n';
    }
    else
    {
    while (p!=0 && b!=0)
    {
      p--;
      b--;
    }
    if (p==0)
    {
      while (b>0 && b<1)
      {
        b=b-2;
      }
      if (b==1)
      {
        g<<0<<'\n';
      }
      else
      {
        g<<1<<'\n';
      }
    }
    if (b==0)
    {
      while (p!=0 || p!=1)
      {
        p=p-2;
      }
      if (p==1) g<<0<<'\n';
        else g<<1<<'\n';
    }
    }
  }
}