Advertisement
Guest User

kinko

a guest
Oct 21st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int n, w, kasa;
  5. int a;
  6. int banknotki[105];
  7. int main()
  8. {
  9. ios_base::sync_with_stdio(0);
  10. cin>>n;
  11. for (int i=1; i<=n; i++)
  12. {
  13. cin>>a;
  14. banknotki[a]++;
  15. if (a==25)
  16. continue;
  17.  
  18. else if (a==50)
  19. {
  20. if (banknotki[25]>0)
  21. {
  22. banknotki[25]--;
  23. continue;
  24. }
  25. else
  26. {
  27. cout<<"NIE";
  28. return 0;
  29. }
  30. }
  31. else if (a==100)
  32. {
  33. if (banknotki[25]>0&&banknotki[50]>0)
  34. {
  35. banknotki[25]--;
  36. banknotki[50]--;
  37. continue;
  38. }
  39. else if (banknotki[25]>=3)
  40. {
  41. banknotki[25]-=3;
  42. continue;
  43. }
  44. else
  45. {
  46. cout<<"NIE";
  47. return 0;
  48. }
  49. }
  50. }
  51. cout<<"TAK";
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement