SGU 107 987654321 problem
|
107. 987654321 problem time limit per test: 0.5 sec. memory limit per test: 4096 KB
For given number N you must output amount of N-digit numbers, such, that last digits of their square is equal to 987654321.
Input Input contains integer number N (1<=N<=106)
Output Write answer to the output.
Sample Input 8 Sample Output 0 |
1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 #include <map> 3 #include <queue> 4 #include <vector> 5 #include <string> 6 #include <cmath> 7 #include <cstdio> 8 #include <cstring> 9 #include <cstdlib> 10 #include <iostream> 11 #include <algorithm> 12 using namespace std; 13 #define maxn 105 14 #define ll long long 15 #define INF 0x7fffffff 16 #define eps 1e-8 17 int n,m; 18 int main(){ 19 while (~scanf("%d",&n)){ 20 if (n == 9){printf("8\n"); continue;} 21 if (n < 9){printf("0\n"); continue;} 22 printf("7"); 23 printf("2\n"); 24 for (int i = 1; i < n - 9; i++)printf("0"); 25 } 26 return 0; 27 }
浙公网安备 33010602011771号