Advertisement
theo830

coins 2009

Jun 5th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int t[3][8];
  5. string f[13][2];
  6.  
  7. int main()
  8. { string res = "xxx";
  9. for(int w=0; w<3; w++)
  10. { for(int j=0; j<4; j++)
  11. cin >> t[w][j];
  12. cin >> res[w];
  13. for(int j=4; j<8; j++)
  14. cin >> t[w][j];
  15. }
  16.  
  17. for(int c=1; c<=12; c++)
  18. { f[c][0]=f[c][1]="===";
  19. for(int w=0; w<3; w++)
  20. { for(int j=0; j<4; j++)
  21. { int c = t[w][j];
  22. f[c][0][w] = '<';
  23. f[c][1][w] = '>';
  24. }
  25. for(int j=4; j<8; j++)
  26. { int c = t[w][j];
  27. f[c][0][w] = '>';
  28. f[c][1][w] = '<';
  29. }
  30. }
  31. }
  32.  
  33. int sol=0;
  34. int fls;
  35. char sgn;
  36. for(int c=1; c<=12; c++)
  37. { if(f[c][0]==res) {
  38. sol++;
  39. fls=c;
  40. sgn='-'; }
  41. if(f[c][1]==res) {
  42. sol++;
  43. fls=c;
  44. sgn='+'; }
  45. }
  46.  
  47. if(sol==1)
  48. cout << fls << sgn << endl;
  49. if(sol==0)
  50. cout << "impossible" << endl;
  51. if(sol>=2)
  52. cout << "indefinite" << endl;
  53.  
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement