Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- using namespace std;
- int n, a, b, zlicz;
- int t[1000000];
- int main ()
- {
- ios_base::sync_with_stdio(0);
- cin>>n;
- for (int i=0; i<n; i++)
- {
- cin>>a>>b;//a to grubosc, b to rodzaj drzewa
- t[b]++;//Tutaj zliczam wystapienia drzew o takim samym gatunku
- }
- for (int i=0; i<n; i++)
- {
- if(t[i]>0)zlicz++;//Tutaj dodaje +1 do wyniku jesli dany gatunek wystepuje przynajmniej 1 raz
- }
- cout<<zlicz;//wypisuje wynik
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement