Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n, w, kasa;
- int a;
- int banknotki[105];
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin>>n;
- for (int i=1; i<=n; i++)
- {
- cin>>a;
- banknotki[a]++;
- if (a==25)
- continue;
- else if (a==50)
- {
- if (banknotki[25]>0)
- {
- banknotki[25]--;
- continue;
- }
- else
- {
- cout<<"NIE";
- return 0;
- }
- }
- else if (a==100)
- {
- if (banknotki[25]>0&&banknotki[50]>0)
- {
- banknotki[25]--;
- banknotki[50]--;
- continue;
- }
- else if (banknotki[25]>=3)
- {
- banknotki[25]-=3;
- continue;
- }
- else
- {
- cout<<"NIE";
- return 0;
- }
- }
- }
- cout<<"TAK";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement