2016年中国の大学対抗プログラミングコンテスト - ネットワークトライアルA Wtaer問題

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define N 12000000
char s[N];
int main()
{
    int k=0,len,x,d,i;
    while(scanf("%s",s)!=EOF)
    {
        k++;
        len=strlen(s);
        x=10001;
        d=0;
        for(i=0;i<len;i++)
            {
                d=(d*10+(s[i]-'0')%x)%x;从s[0]道s[n-1];把位数一步一步
            }
        if(d==0)
            printf("Case #%d: YES\n",k);
        else
            printf("Case #%d: NO\n",k);
    }
    return 0;
}

公開された29元の記事 ウォンの賞賛3 ビュー3202

おすすめ

転載: blog.csdn.net/qq_38436175/article/details/75660592