Advertisement
icatalin

chibrituri

Dec 10th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("chibrituri.in")
  6. ofstream fout("chibrituri.out")
  7.  
  8. int main()
  9. {
  10.     int k=0,vert,oriz,SV,SO,xmin,xmax,h,m,hu,hz,mu,mz,i,v[10],o[10];
  11.     v[]={4,2,2,2,3,2,3,2,4,3};
  12.     o[]={2,0,3,3,1,3,3,1,3,3};
  13.     fin>>vert>>oriz;
  14.     xmin=1439;
  15.     xmax=0;
  16.     for (x=0;x<=1439;x++)
  17.     {
  18.         hu=x/60/10;
  19.         hz=x/60%10;
  20.         mu=x%60%10;
  21.         mz=x%60/10;
  22.         SV=v[hu]+v[hz]+v[mu]+v[mz];
  23.         SO=o[hu]+o[hz]+o[mu]+o[mz];
  24.         if (SV==vert && SO==oriz)
  25.         {
  26.             k++;
  27.             if (x<xmin)
  28.             xmin=x;
  29.             if (x>xmax)
  30.             xmax=x;
  31.        
  32.    
  33.         }
  34.     }
  35.    
  36.     fout<<k<<'\n';
  37.     fout<<xmin/60/10<<xmin/60%10<<":"<<xmin%60/10<<xmin%60%10<<'\n';
  38.     fout<<xmax/60/10<<xmax/60%10<<":"<<xmax%60/10<<xmax%60%10<<'\n';
  39.     fin.close();
  40.     fout.close();
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement