#include<stdio.h> #include<stdlib.h> #define MaxLen 100 int main() { int n,i,j,count; char a[MaxLen ]; char *p = NULL; printf("请输入大数的个数,并连续输入其具体数字\n"); scanf("%d", &n); p = malloc(n); memset(p, 0, n); for (i = 0; i < n; i++) { scanf("%s", a); count = 0; for (j = 0; j < MaxLen; j++) { count += a[i] - '0'; } if (count % 3 == 0) { *(p + i ) = 1; } } for (i = 0; i < n; i++) { if (*(p + i) == 1) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[此贴子已经被作者于2016-4-18 09:55编辑过]