hdu 1212 Big Number 大数取模
Description To make the problem easier,I promise that B will be smaller than 100000. Is it too hard? No,I work it out in 10 minutes,and my program contains less than 25 lines. Input Output Sample Input Sample Output 大数取模 #include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#pragma comment(linker,"/STACK:102400000,102400000")
#define pi acos(-1.0)
#define EPS 1e-6
#define INF (1<<24)
using namespace std;
int main()
{
char A[1005];
int mod;
while(scanf("%s %d",A,&mod)!=EOF)
{
int len=strlen(A);
int i;
int sum=0;
for(i=0;i<len;i++)
{
sum=sum*10+A[i]-'0';
sum=sum%mod;
}
printf("%dn",sum);
}
return 0;
}
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |