SGU 107

107. 987654321 problem

time limit per test: 0.25 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


打表可知当n == 9时有八个解,大于9的解由乘法原理易算
 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 #include <algorithm>
 5 
 6 using namespace std;
 7 
 8 int n;
 9 int main()
10 {
11 
12     scanf("%d",&n);
13 
14     if( n <= 8 ) {
15             printf("0\n");
16 
17     } else if(n == 9) {
18             printf("8\n");
19     } else {
20             printf("72");
21             for(int i = 10; i < n; i++) {
22                     printf("0\n");
23             }
24     }
25     return 0;
26 }
View Code

 

posted @ 2014-03-08 13:39  hyx1  阅读(158)  评论(0编辑  收藏  举报