hdu 5832 A water problem 大數取模問題 大水

大數取模問題,模擬除法,從第一個數字開始不斷地對10001取模即可

#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;

char s[10000010];
int main()
{
    int cnt = 1;
    while(~scanf("%s", s)){
        int mod = 0;
        for(int i = 0;s[i];i++){
            mod = (mod*10+s[i]-'0')%10001;
        }
        if(mod)
            printf("Case #%d: NO\n",cnt);
        else
            printf("Case #%d: YES\n",cnt);
        cnt++;
    }

    return 0;
}

2016 ccpc 網絡賽

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章