Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by monty ( 16 years ago )
#include <iostream>
using namespace std;

int main()

{
    unsigned long long XLD=0,YLD=0,XPG=0,YPG=0;
    while(cin>>XLD>>YLD>>XPG>>YPG){
    unsigned long long ilosc=0;
    bool czy=false;
    unsigned long long XLD_=XLD, YLD_=YLD, XPG_=XPG;
    while(YLD_<YPG)
    { unsigned long long pom=0;
      bool czy=false;  
      
      
     if ((XPG-XLD)!=1) { 
      
               
      if (YLD%2 == 0) 
         {if (XPG!=1) 
              {if (XPG%2 != 0) 
              {XPG++;czy=true;}
              }
              if (XPG>YLD)
                  {if (XLD<YLD)  XLD=YLD+1;
                  if (XPG!=1) {pom=XPG-XLD; }
                  if (pom>0){ if (pom % 2 != 0) 
                           {if (czy==true) 
                           {pom--;pom=pom/2;}
                           else {pom++; pom=pom/2;}
                           }
                    else 
                           {if (czy==true) 
                           {pom=(pom-1)/2;}
                           else {pom=pom/2;}
                           }
                    ilosc+=pom; }
                    }
          }
          
      else 
           {if (XPG!=1) 
               {if(XPG%2 != 0) {XPG++;czy=true;}
               }
           if (XPG>YLD)
            {if (YLD>=XLD) 
           //  {if(XPG!=XLD){pom=YLD-XLD+1;cout<<pom<<"^";} else {pom=YLD-XLD;cout<<pom<<"&";}
              { pom=YLD-XLD+1;
               ilosc+=pom;  
               XLD=YLD+1; if ((czy==true) && (XPG==XLD)) ilosc--;}
               pom=XPG-XLD;
               if (pom>0){
                if (pom % 2 != 0)
                        {if (czy==true) {pom--; pom=pom/2;} 
                        else {pom++; pom=pom/2;}
                        }
                else 
                        {if (czy==true) {pom=(pom-1)/2;} else pom=pom/2; }
                           ilosc+=pom;}
           
           } 
           else 
                {pom=XPG-XLD; ilosc+=pom; if (czy==true) ilosc--;}
      }
}

else  {
if (YLD%2 != 0)
               {if (XLD%2 == 0)
                   {if (YLD>XLD) ilosc++;}
                else if (XLD%2 != 0)
                   {ilosc++;}
            }
            else if (YLD%2 == 0)
                {if (XLD%2 != 0)
                    {if (YLD<XLD) ilosc++;}
                }   
}


YLD_++;YLD=YLD_;XLD=XLD_; XPG=XPG_;}
cout<<ilosc<<endl;}
    return 0;}

 

Revise this Paste

Parent: 20134
Your Name: Code Language: