AlenAntonelli

Mural_Alen

May 12th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.70 KB | None | 0 0
  1. ///Trello, Facil, Un mural para el patio de la escuela
  2. #include <iostream> /// AlenAntonelli
  3. #include <vector>
  4. using namespace std;
  5. int main ()
  6. {
  7.     int T, ph, pv;
  8.     int nf, cd, ch;
  9.     int nc, fd, fh;
  10.     char P;
  11.     cin>>T>>ph>>pv;
  12.     cout<<endl;
  13.     string aux (T, '.');
  14.     vector <string> M (T, aux);
  15.     for (int f=1; f<=ph; f++)
  16.     {
  17.         cin>>nf>>P>>cd>>ch;
  18.         cout<<endl;
  19.         for (int c=cd-1; c<ch; c++)
  20.         {
  21.             if (M[nf-1][c]=='.')
  22.                 M[nf-1][c]=P;
  23.             else
  24.             {
  25.                 if (  (M[nf-1][c]=='R' && P=='A') || (M[nf-1][c]=='A' && P=='R')  )
  26.                     M[nf-1][c]='N';
  27.                 if (  (M[nf-1][c]=='R' && P=='Z') || (M[nf-1][c]=='Z' && P=='R')  )
  28.                     M[nf-1][c]='P';
  29.                 if (  (M[nf-1][c]=='A' && P=='Z') || (M[nf-1][c]=='Z' && P=='A')  )
  30.                     M[nf-1][c]='V';
  31.             }
  32.         }
  33.     }
  34.     cout<<endl<<endl;
  35.     for (int c=1; c<=pv; c++)
  36.     {
  37.         cin>>nc>>P>>fd>>fh;
  38.         cout<<endl;
  39.         for (int f=fd-1; f<fh; f++)
  40.         {
  41.  
  42.             if (M[f][nc-1]=='.')
  43.                 M[f][nc-1]=P;
  44.             else
  45.             {
  46.                 if (  (M[f][nc-1]=='R' && P=='A') || (M[f][nc-1]=='A' && P=='R')  )
  47.                 {
  48.                     M[f][nc-1]='N';
  49.                 }
  50.                 if (  (M[f][nc-1]=='R' && P=='Z') || (M[f][nc-1]=='Z' && P=='R')  )
  51.                     M[f][nc-1]='P';
  52.                 if (  (M[f][nc-1]=='A' && P=='Z') || (M[f][nc-1]=='Z' && P=='A')  )
  53.                     M[f][nc-1]='V';
  54.             }
  55.         }
  56.     }
  57.     for( int i=0; i<T; i++)
  58.         cout<<M[i]<<endl;
  59.        
  60.     return T;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment