• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

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 }
View Code
posted @ 2013-11-01 07:42  HaibaraAi  阅读(162)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3