Remainder time limit: 1000 ms | Memory limit: 65535 KB Difficulty: 3 Description now give you a natural number n, its number is less than or equal to 1 million, now all you have to do is figure out the remainder after 10003. The first row has an integer m (1<=m<=8), which indicates that there are m groups of test data;
Then the M row has a natural number n per line. Output n divides the remainder after 10003 and takes one row for each output. Sample input
3
4
5
465456541
Sample output
4
5
6948
#include <iostream>
#include <stdio.h>
using namespace std;
Char a[1000005];
123% n = ((( (1%n * 10%n + 2%n)%n*10%n)%n+3%n )%n
int main ()
{
int n;< C18/>cin >> N;
while (n--)
{
scanf ("%s", a);
Long nc=0,rest;
for (; a[nc]!= '; nc++ ')
{
a[nc]-= ' 0 ';
if (NC = = 0)
{
rest = A[nc]% 10003
}
else
{
rest= (rest * + A[NC])%10003
}
cout << rest << Endl;
}
return 0;
}