題目有10^100000,因此請用字串讀入:
字串mod函數(C++/C):
int mod(string num, int a)
{
// Initialize result
int res = 0;
// One by one process all digits of 'num'
for (int i = 0; i < num.length(); i++)
res = (res*10 + (int)num[i] - '0') %a;
return res;
}
祝大家解題順利!