AlenAntonelli

Pintando_la_biciseda_Alen

May 12th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. ///Trello, Principiante, Pintando la bicisenda
  2. #include <iostream> /// AlenAntonelli
  3. #include <vector>
  4. using namespace std;
  5. int main ()
  6. {
  7.     int B=0, t=0, p, f, e, i;
  8.     char c;
  9.     cin >> B >> t;
  10.     vector <char> v (B, '.');
  11.     for (e=0; e<t; e++)//for Externo que recorre todas los tramos
  12.     {
  13.         cin >> p >> f >> c;
  14.         for (i=p-1; i<f; i++) //for Interno que recorre los espacios en los que se asigna o reasigna un color
  15.         {
  16.             if (v[i]=='.')//si no hay color le asigno el que tengo
  17.                 v[i]=c;
  18.             if ((v[i]=='R' && c=='A') || (v[i]=='A' && c=='R'))
  19.                 v[i]='N';///formo el narana
  20.             if ((v[i]=='R' && c=='Z') || (v[i]=='Z' && c=='R'))
  21.                 v[i]='P';///formo el narana
  22.             if ((v[i]=='Z' && c=='A') || (v[i]=='A' && c=='Z'))
  23.                 v[i]='V';///formo el narana
  24.             if (  (v[i]=='N' && c=='Z')  ||  (v[i]=='P' && c=='A')  ||  (v[i]=='V' && c=='R')  )
  25.                 v[i]='M';///formo el narana
  26.         }
  27.     }
  28.  
  29.     for (i=0; i<B; i++)
  30.         cout << v[i];
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment