Advertisement
rengetsu

MIDI_CodeJam.1.Dalys

Apr 6th, 2018
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n,kiek[4],fin[4],r;
  7.     string g,s[4],sk[4];
  8.     s[0]="a",s[1]="a",s[2]="a",s[3]="a";
  9.     fin[0]=0,fin[1]=0,fin[2]=0,fin[3]=0;
  10.     cin>>n;
  11.     for(int i=0;i<n;i++)
  12.     {
  13.         cin>>g;
  14.         if(s[0]=="a" || s[0]==g)
  15.         {
  16.             s[0]=g;
  17.             cin>>kiek[0];
  18.             if(kiek[0]==15){fin[0]+=21;}
  19.             if(kiek[0]==0)
  20.             {
  21.                 cin>>sk[0];
  22.                 if(sk[0]=="ff"){fin[0]+=255;}
  23.             }
  24.         }
  25.         else if((s[0]!=g && s[1]=="a") || s[1]==g)
  26.         {
  27.             s[1]=g;
  28.             cin>>kiek[1];
  29.             if(kiek[1]==15){fin[1]+=21;}
  30.             if(kiek[1]==0)
  31.             {
  32.                 cin>>sk[1];
  33.                 if(sk[1]=="ff"){fin[1]+=255;}
  34.             }
  35.         }
  36.         else if((s[0]!=g && s[1]!=g && s[2]=="a") || s[2]==g)
  37.         {
  38.             s[2]=g;
  39.             cin>>kiek[2];
  40.             if(kiek[2]==15){fin[2]+=21;}
  41.             if(kiek[2]==0)
  42.             {
  43.                 cin>>sk[2];
  44.                 if(sk[2]=="ff"){fin[2]+=255;}
  45.             }
  46.         }
  47.         else if((s[0]!=g && s[1]!=g && s[2]!=g && s[3]=="a") || s[3]==g)
  48.         {
  49.             s[3]=g;
  50.             cin>>kiek[3];
  51.             if(kiek[3]==4){fin[3]+=4;}
  52.             if(kiek[3]==15){fin[3]+=21;}
  53.             if(kiek[3]==0){
  54.                 cin>>sk[3];
  55.                 if(sk[3]=="ff"){fin[3]+=255;}
  56.             }
  57.         }
  58.     }
  59.     //isvedam atsakyma
  60.     for(int y=0;y<4;y++)
  61.     {
  62.         if(s[y]!="a" && s[y]!="ff")
  63.         {
  64.         cout<<s[y];
  65.             if(fin[y]==765){cout<<" 2fd"<<endl;}
  66.             else if(fin[y]==510){cout<<" 1fe"<<endl;}
  67.             else if(fin[y]==42){cout<<" 2a"<<endl;}
  68.             else if(fin[y]==12){cout<<" c"<<endl;}
  69.             else{cout<<endl;}
  70.         }
  71.     }
  72.     return 0;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement