kkmomo

Untitled

May 8th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. /**********************************************************************************/
  2. /*  Problem: d124 "3的倍数" from                                               */
  3. /*  Language: C (353 Bytes)                                                       */
  4. /*  Result: AC(0ms, 268KB) judge by this@ZeroJudge                                */
  5. /*  Author: kkmomo at 2013-05-08 22:59:36                                         */
  6. /**********************************************************************************/
  7.  
  8.  
  9. #include<stdio.h>
  10.  
  11. #define BUFFSIZE 10000
  12.  
  13. int main(void)
  14. {
  15.     int index, check;
  16.     char buff[BUFFSIZE+1];
  17.     check = 0;
  18.     while(scanf("%s", buff)!=EOF)
  19.     {
  20.         index = buff[0]=='-' ? 1 : 0;
  21.         for ( check = 0; buff[index]!='\0'; index++)
  22.             check += buff[index];
  23.         if (check%3!=0)
  24.             printf("no\n");
  25.         else
  26.             printf("yes\n");
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment