Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <algorithm>
  4. using namespace std;
  5. int liczbaLiczb, poprawne;
  6. int liczby[1000001];
  7. int main()
  8. {
  9. ios_base::sync_with_stdio(0);
  10. cin>>liczbaLiczb;
  11. for (int i=0; i<liczbaLiczb; i++)
  12. {
  13. cin>>liczby[i];
  14. }
  15. sort(liczby,liczby+liczbaLiczb);
  16. for (int i=0; i<liczbaLiczb; i++)
  17. {
  18. if (liczby[i]!=i+1) poprawne++;
  19. }
  20.  
  21. if (poprawne>0) cout<<"NIE";
  22. else cout<<"TAK";
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement