标签:mod 限制 iostream 难度 lan http text otto arch
如今给你一个自然数n。它的位数小于等于一百万,如今你要做的就是求出这个数整除九之后的余数。
3 4 5 465456541
4 5 4
回想一下大数相除~~
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
char a[1000000];
int main()
{
int T,yushu,len,i,s;
cin>>T;
while(T--)
{
yushu=0;
cin>>a;
len=strlen(a);
for(i=0;i<len;i++)
{
s=yushu*10+(a[i]-'0');
yushu=s%9;
}
cout<<yushu<<endl;
}
return 0;
}
标签:mod 限制 iostream 难度 lan http text otto arch
原文地址:http://www.cnblogs.com/jzssuanfa/p/7071458.html