velimir

mojBroj

Jan 19th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x, y, m, n, m1, n1, m2=0, n2=0, j=0, l=0, k=0, g=0;
  8.     for(int i=1; i<=3; i++)
  9.     {
  10.         cin >> x >> y;
  11.         if(x>k)k = x;
  12.         if(y>g)g = y;
  13.         m = x;
  14.         n = y;
  15.         while(m>0)
  16.         {
  17.             m1 = m%10;
  18.             m/=10;
  19.             m2+=m1;
  20.         }
  21.         while(n>0)
  22.         {
  23.             n1 = n%10;
  24.             n/=10;
  25.             n2+=n1;
  26.         }
  27.         if(x%m2 == 0)
  28.         {
  29.             j+=2;
  30.             l--;
  31.         }
  32.         if(y%n2 == 0)
  33.         {
  34.             l+=2;
  35.             j--;
  36.         }
  37.         m2 = 0;
  38.         n2 = 0;
  39.     }
  40.     cout << j << " " << l << endl;
  41.     if(j==l)
  42.     {
  43.         if(k>g)cout << "Stefan";
  44.         else cout << "Ana";
  45.     }
  46.     else
  47.     {
  48.         if(j>l)cout << "Stefan";
  49.         else cout << "Ana";
  50.     }
  51.  
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment