fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. const int MAX_SIZE = 256;
  7. char *c = new char [MAX_SIZE];
  8. cin.getline (c,MAX_SIZE);
  9. int a=0;
  10. for(int i=0;i<strlen(c);i++){
  11. a+=c[i]-'0';
  12. }
  13. if(a%3==0)cout<<"YES";
  14. else cout<<"NO";
  15. return 0;
  16. }
Success #stdin #stdout 0s 3416KB
stdin
12345
stdout
YES