题目地址:http://acm.sgu.ru/problem.php?contest=0&problem=107
1 /*
2 题意:n位数的平方的后面几位为987654321的个数
3 尼玛,我看描述这一句话都看了半天,其实只要先暴力程序测试一边就知道规律
4 详细解释:http://www.cnblogs.com/Rinyo/archive/2012/12/04/2802089.html
5 */
6 #include <cstdio>
7 #include <iostream>
8 #include <algorithm>
9 #include <cmath>
10 using namespace std;
11
12 int main(void) //SGU 107 987654321 problem
13 {
14 int n;
15 while (~scanf ("%d", &n))
16 {
17 if (n <= 8) puts ("0");
18 else if (n == 9)
19 printf ("%d
", 8);
20 else
21 {
22 printf ("%d", 72);
23 int tmp = n - 10;
24 while (tmp--)
25 printf ("%d", 0);
26 printf ("
");
27 }
28 }
29
30 return 0;
31 }