Remainder time limit of nine: theMs | Memory Limit:65535KB Difficulty:3
-
-
Describe
-
Now give you a natural number n, whose number is less than or equal to 1 million, now all you have to do is find the remainder after the number is divisible by nine.
-
-
Input
-
-
the first line has an integer m (1<=m<=8), which indicates that there is an M-group of test data;
The M row then has a natural number n per row.
-
-
Output
-
-
output n is divided by the remainder after nine, with each output occupying one row.
-
-
Sample input
-
-
345465456541
-
-
Sample output
-
-
454
-
-
Source
-
-
[Miao Building] Original
-
-
Uploaded by
Miao-dong Building
Review the division of large numbers ~ ~
#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;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The remainder of nine