fork download
  1.  
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5. int main()
  6. {
  7. int a, b, d=0, e=0, f=0;
  8. cin>>a;
  9.  
  10.  
  11. for(int c=0;c<a;c++){
  12. cin>>b;
  13.  
  14. if(b%3==0)
  15. d+=1;
  16. else if(b%3==1)
  17. e+=1;
  18. else
  19. f+=1;
  20. }
  21. cout<<d<<" "<<e<<" "<<f;
  22.  
  23. return 0;
  24. }
  25.  
  26.  
Success #stdin #stdout 0.01s 5328KB
stdin
5
1
2
3
4
5
stdout
1 2 2