fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int d[1005], a, dem;
  4.  
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0); cout.tie(0);
  9.  
  10. while(cin >> a)
  11. {
  12. d[a]++;
  13. }
  14. for(int i = 1; i <= 1000; i++)
  15. {
  16. if (d[i] > 0)
  17. {
  18. dem++;
  19. }
  20. }
  21. cout << dem << endl;
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0.01s 5284KB
stdin
2 4 2 5 4 5 2 5 4 5 5 
stdout
3