//大数取模
#include "cmath"
#include "iostream"
#include "string.h"
using namespace std;
int mod(char str[],int num)
{
int number[100];
for(int i=0;i<strlen(str);i++)
number[i]=str[i]-'0';
int remainder=0;
for(int i=0;i<strlen(str);i++)
{
remainder=((long long)remainder*10+number[i])%num;
}
return remainder;
}
int main(){
char ch[10] = {'1','3','\0'};
cout << mod(ch, 5);
return 0;
}
大数取模
最新推荐文章于 2021-04-18 09:48:20 发布