数据量大的吓人,不可能常规做,那就用数组吧
#include<stdio.h>
#include<iostream>#include<string.h>
using namespace std;
char num[50];
int main()
{
int len;
int i,k,sum;
while (~scanf ("%s",num))
{
sum=0;
len=strlen(num);
k=num[len-1]-'0';
if (k%2==0) {printf("YES\n"); continue; memset(num,0,sizeof(num));}
if (k%5==0) {printf("YES\n"); continue; memset(num,0,sizeof(num));}
for (i=0; i<len; i++)
{
sum+=num[i]-'0';
}
if (sum%3==0) {printf("YES\n"); continue; memset(num,0,sizeof(num));}
printf("NO\n");
memset(num,0,sizeof(num));
}
}