Question 96
Question information running result this question ranking discussion area n-1 digits
Time Limit: 3000 MS | memory limit: 65535 KB
Difficulty: 1
Description
It is known that W is an unsigned integer greater than 10 but not greater than 1000000. If W is an integer n (n ≥ 2), the number of the last n-1 digits of W is obtained.
Input
The first act is m, which indicates the number of test data groups.
In the next m rows, each row contains a test data.
Output
Output m rows. Each row corresponds to the n-1 digits of the row (the prefix 0 is ignored ). If all the other bits except the highest bit are 0, the output is 0.
Sample Input
4
1023
5923
923
1000 sample output
23
923
23
0
// Use a string:
# Include <iostream>
# Include <cstring>
Using namespace STD;
Int main ()
{Char s [10];
Int I, N, K, M, J;
Cin> m;
While (M --)
{
Cin> S;
K = strlen (s );
For (I = 1; I <K; I ++)
If (s [I]! = '0') break;
If (I = k) {cout <0 <Endl; continue ;}
For (j = I; j <K; j ++)
Cout <s [J];
Cout <Endl;
}
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int N;
Int m;
Scanf ("% d", & N );
While (n --)
{
Scanf ("% d", & M );
If (M = 1000000 | M = 100000 | M = 10000 | M = 1000 | M = 100 | M = 10)
M = 0;
If (M> 10 & M <100) M % = 10;
Else if (M <1000) M % = 100;
Else if (M <10000) M % = 1000;
Else if (M <100000) M % = 10000;
Else if (M <1000000) M % = 100000;
Printf ("% d \ n", M );
}
Return 0;
}
# Include <cstdio>
Int main ()
{
Int n, m;
Scanf ("% d", & N );
While (n --)
{
Scanf ("\ n % * C % d", & M); // remove the first entry from the input content. If the input is 845, 45 is placed in M.
Printf ("% d \ n", M );
}
}