pages:
  • 1
Daneshvar Amrollahi SAYS

Hi. What does it mean in "rare cases"? When should we print "Hole-in-one"? It said double boggey is when it is 2 over pal but in the sample input, it seems wrong..? :-? Can anyone explain the problem more clearly? (Even in Farsi) Thanks

testuser SAYS

hi.age stroke 1 bashe sarfenazar az par mishe hole in one dar gheire in surat age ekhtelafe s-p=-1 ---> birdie , s-p=2 --->double bogey,.....

Daneshvar Amrollahi SAYS

In bayad dorost bashe? Too sample soal do ta adad dade ke 3 ta ekhtelaf daran vali neveshte double bogey. eshtebah nist?

      if (s==1)
         cout<<"Hole-in-one";         

      if (s-p==-1) 
         cout<<"Birdie.";

      if (s-p==1) 
         cout<<"Bogey.";

      if (s-p==-2) 
         cout<<"Eagle.";

      if (s-p==-3) 
         cout<<"Double Eagle.";

      if (s-p==2) 
         cout<<"Double Bogey.";

      if (s==p)
         cout<<"Par.";
testuser SAYS

2 nokte: 1- age bishtar az 2 ham beshe baz ham mishe Double Bogey ......

2- tuye codetun vaqti hole in one ro chap kardidi shoma bayad barname ro moteveqef konid tuye codetun 1 khate dg ham chap mikone :D

Daneshvar Amrollahi SAYS

Kasi mi2ne bege in chera kar nemikone? motmaennam bekhatere in shartast...:-?

#include<iostream>
using namespace std;
int main()
{
int i = 1;
int p,s;
while (cin>>p>>s)
{
      if (p==0) 
         return 0;

      bool done = false;

      cout<<"Hole #"<<i<<endl;

      if (s==1)
      {
         done = true;
         cout<<"Hole-in-one";
      }         

      if (done==false)
      if (s-p==-1) 
      {
         //done = true;
         cout<<"Birdie.";
      }

      if (done==false)   
      if (s-p==1) 
      {
         //done = true;
         cout<<"Bogey.";
      }

      if (done==false)   
      if (s-p==-2) 
      {
         //done = true;
         cout<<"Eagle.";
      }

      if (done==false)
      if (s-p<=-3)
      {
         //done = true;
         cout<<"Double Eagle.";
      }

      if (done==false)
      if (s-p>=2) 
      {
         //done = true;
         cout<<"Double Bogey.";
      }

      if (done==false)
      if (s==p)
      {
         //done = true;
         cout<<"Par.";
      }

      i++;   
      cout<<endl<<endl;
}

return 0;
}