Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. using namespace std;
  5. int n, a, b, zlicz;
  6. int t[1000000];
  7. int main ()
  8. {
  9. ios_base::sync_with_stdio(0);
  10. cin>>n;
  11. for (int i=0; i<n; i++)
  12. {
  13. cin>>a>>b;//a to grubosc, b to rodzaj drzewa
  14. t[b]++;//Tutaj zliczam wystapienia drzew o takim samym gatunku
  15. }
  16. for (int i=0; i<n; i++)
  17. {
  18. if(t[i]>0)zlicz++;//Tutaj dodaje +1 do wyniku jesli dany gatunek wystepuje przynajmniej 1 raz
  19. }
  20. cout<<zlicz;//wypisuje wynik
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement