Advertisement
rengetsu

MIDI_CodeJam.6.Zaidimu_automatas

Apr 6th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.04 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int x[10], sum=0;
  6.     for(int i=0;i<10;i++)
  7.     {
  8.         cin>>x[i];
  9.         sum+=x[i];
  10.     }
  11.     if(sum/10==x[1])
  12.     {
  13.         cout<<"GALIMA"<<endl;
  14.         cout<<"0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0";
  15.         return 0;
  16.     }
  17.     else
  18.     {
  19.         //1
  20.         if(((x[3]+1)==x[1]) && ((x[4]+1)==x[1]) && ((x[7]+1)==x[1]) && ((x[8]+1)==x[1]) && ((x[9]+1)==x[1]))
  21.         {
  22.             if((sum+5)/10==x[1])
  23.             {
  24.                 cout<<"GALIMA"<<endl;
  25.                 cout<<"1\n1\n0\n0\n0\n0\n0\n0\n0\n0\n0";
  26.             return 0;
  27.             }
  28.         }
  29.         //2
  30.         if(((x[8]+1)==x[1]) && ((x[9]+1)==x[1]))
  31.         {
  32.             if((sum+2)/10==x[1])
  33.             {
  34.                 cout<<"GALIMA"<<endl;
  35.                 cout<<"1\n0\n1\n0\n0\n0\n0\n0\n0\n0\n0";
  36.             return 0;
  37.             }
  38.         }
  39.         //3
  40.         if(((x[7]+1)==x[1]) && ((x[9]+1)==x[1]))
  41.         {
  42.             if((sum+2)/10==x[1])
  43.             {
  44.                 cout<<"GALIMA"<<endl;
  45.                 cout<<"1\n0\n0\n1\n0\n0\n0\n0\n0\n0\n0";
  46.             return 0;
  47.             }
  48.         }
  49.         //4
  50.         if(((x[2]+1)==x[1]) && ((x[4]+1)==x[1]) && ((x[8]+1)==x[1]) && ((x[9]+1)==x[1]))
  51.         {
  52.             if((sum+4)/10==x[1])
  53.             {
  54.                 cout<<"GALIMA"<<endl;
  55.                 cout<<"1\n0\n0\n0\n1\n0\n0\n0\n0\n0\n0";
  56.             return 0;
  57.             }
  58.         }
  59.         //5
  60.         if(((x[5]+1)==x[1]) && ((x[7]+1)==x[1]) && ((x[8]+1)==x[1]))
  61.         {
  62.             if((sum+3)/10==x[1])
  63.             {
  64.                 cout<<"GALIMA"<<endl;
  65.                 cout<<"1\n0\n0\n0\n0\n1\n0\n0\n0\n0\n0";
  66.             return 0;
  67.             }
  68.         }
  69.         //6
  70.         if(((x[1]+1)==x[1]) && ((x[2]+1)==x[1]) && ((x[3]+1)==x[1]) && ((x[4]+1)==x[1]) && ((x[7]+1)==x[1]) && ((x[9]+1)==x[1]))
  71.         {
  72.             if((sum+6)/10==x[1])
  73.             {
  74.                 cout<<"GALIMA"<<endl;
  75.                 cout<<"1\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0";
  76.             return 0;
  77.             }
  78.         }
  79.         //7
  80.         if(((x[0]+1)==x[1]) && ((x[1]+1)==x[1]) && ((x[3]+1)==x[1]) && ((x[5]+1)==x[1]) && ((x[7]+1)==x[1]) && ((x[8]+1)==x[1]) && ((x[9]+1)==x[1]))
  81.         {
  82.             if((sum+7)/10==x[1])
  83.             {
  84.                 cout<<"GALIMA"<<endl;
  85.                 cout<<"1\n0\n0\n0\n0\n0\n0\n1\n0\n0\n0";
  86.             return 0;
  87.             }
  88.         }
  89.         //8
  90.         if((x[9]+1)==x[1])
  91.         {
  92.             if((sum+1)/10==x[1])
  93.             {
  94.                 cout<<"GALIMA"<<endl;
  95.                 cout<<"1\n0\n0\n0\n0\n0\n0\n0\n1\n0\n0";
  96.             return 0;
  97.             }
  98.         }
  99.         //9
  100.         if(((x[6]+1)==x[1]) && ((x[7]+1)==x[1]) && ((x[9]+1)==x[1]))
  101.         {
  102.             if((sum+3)/10==x[1])
  103.             {
  104.                 cout<<"GALIMA"<<endl;
  105.                 cout<<"1\n0\n0\n0\n0\n0\n0\n0\n0\n1\n0";
  106.             return 0;
  107.             }
  108.         }
  109.         //10
  110.         if(((x[4]+1)==x[1]) && ((x[6]+1)==x[1]) && ((x[8]+1)==x[1]) && ((x[9]+1)==x[1]))
  111.         {
  112.             if((sum+4)/10==x[1])
  113.             {
  114.                 cout<<"GALIMA"<<endl;
  115.                 cout<<"1\n0\n0\n0\n0\n0\n0\n0\n0\n0\n1";
  116.             return 0;
  117.             }
  118.         }
  119.         //1 & 2
  120.         if(((x[3]+1)==x[1]) && ((x[4]+1)==x[1]) && ((x[7]+1)==x[1]) && ((x[8]+2)==x[1]) && ((x[9]+2)==x[1]))
  121.         {
  122.             if((sum+7)/10==x[1])
  123.             {
  124.                 cout<<"GALIMA"<<endl;
  125.                 cout<<"2\n1\n1\n0\n0\n0\n0\n0\n0\n0\n0";
  126.             return 0;
  127.             }
  128.         }
  129.         //2 & 3
  130.         if(((x[7]+1)==x[1]) && ((x[8]+1)==x[1]) && ((x[9]+2)==x[1]))
  131.         {
  132.             if((sum+4)/10==x[1])
  133.             {
  134.                 cout<<"GALIMA"<<endl;
  135.                 cout<<"2\n0\n1\n1\n0\n0\n0\n0\n0\n0\n0";
  136.             return 0;
  137.             }
  138.         }
  139.         //3 & 5
  140.         if(((x[5]+1)==x[1]) && ((x[7]+2)==x[1]) && ((x[8]+1)==x[1]) && ((x[9]+2)==x[1]))
  141.         {
  142.             if((sum+6)/10==x[1])
  143.             {
  144.                 cout<<"GALIMA"<<endl;
  145.                 cout<<"2\n0\n0\n1\n0\n1\n0\n0\n0\n0\n0";
  146.             return 0;
  147.             }
  148.         }
  149.         //5 & 8
  150.         if(((x[5]+1)==x[1]) && ((x[7]+1)==x[1]) && ((x[8]+1)==x[1]) && ((x[9]+1)==x[1]))
  151.         {
  152.             if((sum+4)/10==x[1])
  153.             {
  154.                 cout<<"GALIMA"<<endl;
  155.                 cout<<"2\n0\n0\n0\n0\n1\n0\n0\n1\n0\n0";
  156.             return 0;
  157.             }
  158.         }
  159.         //2 & 8
  160.         if(((x[8]+1)==x[1]) && ((x[9]+2)==x[1]))
  161.         {
  162.             if((sum+3)/10==x[1])
  163.             {
  164.                 cout<<"GALIMA"<<endl;
  165.                 cout<<"2\n0\n1\n0\n0\n0\n0\n0\n1\n0\n0";
  166.             return 0;
  167.             }
  168.         }
  169.         //3 & 8
  170.         if(((x[7]+1)==x[1]) && ((x[9]+2)==x[1]))
  171.         {
  172.             if((sum+3)/10==x[1])
  173.             {
  174.                 cout<<"GALIMA"<<endl;
  175.                 cout<<"2\n0\n0\n1\n0\n0\n0\n0\n1\n0\n0";
  176.             return 0;
  177.             }
  178.         }
  179.     }
  180.     return 0;
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement