码迷,mamicode.com
首页 > 其他好文 > 详细

大数求余

时间:2018-03-05 13:47:06      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:大数   style   nbsp   cstring   pac   span   space   bsp   main   

#include<iostream>  
#include<cstring>  
using namespace std;  
int main()  
{  
    char str[1234];  
    int s,len,sum;  
    while(cin>>str>>s)  
    {  
        len=strlen(str);  
        sum=0;  
        for(int i=0;i<len;i++)  
        sum=(sum*10+(str[i]-0)%s)%s;  
        cout<<sum<<endl;
    }  
}

 

大数求余

标签:大数   style   nbsp   cstring   pac   span   space   bsp   main   

原文地址:https://www.cnblogs.com/mayouyou/p/8508377.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!