找规律 SGU 107 987654321 problem

时间:2021-03-04 04:26:31

题目地址:http://acm.sgu.ru/problem.php?contest=0&problem=107

 /*
题意:n位数的平方的后面几位为987654321的个数
尼玛,我看描述这一句话都看了半天,其实只要先暴力程序测试一边就知道规律
详细解释:http://www.cnblogs.com/Rinyo/archive/2012/12/04/2802089.html
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std; int main(void) //SGU 107 987654321 problem
{
int n;
while (~scanf ("%d", &n))
{
if (n <= ) puts ("");
else if (n == )
printf ("%d\n", );
else
{
printf ("%d", );
int tmp = n - ;
while (tmp--)
printf ("%d", );
printf ("\n");
}
} return ;
}