2031. Overturned Numbers

Time limit: 1.0 second

Memory limit: 64 MB
Little Pierre was surfing the Internet and came across an interesting puzzle:
What is the number under the car?
It took some time before Pierre solved the puzzle, but eventually he understood that there were overturned numbers 86, 88, 89, 90, and 91 in the picture and the answer was the number 87.
Now Pierre wants to entertain his friends with similar puzzles. He wants to construct a sequence of
n numbers such that its overturning produces a consecutive segment of the positive integers. Pierre intends to use one-digit integers supplemented with a leading zero and two-digit integers only.To avoid ambiguity, note that when the digits 0, 1, and
8 are overturned, they remain the same, the digits 6 and 9 are converted into each other, and the remaining digits become unreadable symbols.

Input

The only line contains the number n of integers in a sequence (1 ≤
n ≤ 99).

Output

If there is no sequence of length n with the above property, output “Glupenky Pierre” (“Silly Pierre” in Russian).Otherwise, output any of such sequences. The numbers in the sequence should be separated with a space.

Samples

input output
2
11 01
99
Glupenky Pierre

Problem Author: Nikita Sivukhin

Problem Source: Ural Regional School Programming Contest 2014

解析:题目要求翻转后为连续序列的序列,直接枚举就可以。

AC代码:

#include <bits/stdc++.h>
using namespace std; int main(){
int n;
while(scanf("%d", &n) != EOF){
if(n == 1) puts("01");
else if(n == 2) puts("11 01");
else if(n == 3) puts("06 68 88");
else if(n == 4) puts("16 06 68 88");
else puts("Glupenky Pierre");
}
return 0;
}

URAL 2031. Overturned Numbers (枚举)的更多相关文章

  1. 递推DP URAL 1586 Threeprime Numbers

    题目传送门 /* 题意:n位数字,任意连续的三位数字组成的数字是素数,这样的n位数有多少个 最优子结构:考虑3位数的数字,可以枚举出来,第4位是和第3位,第2位组成的数字判断是否是素数 所以,dp[i ...

  2. 递推DP URAL 1009 K-based Numbers

    题目传送门 题意:n位数,k进制,求个数分析:dp[i][j] 表示i位数,当前数字为j的个数:若j==0,不加dp[i-1][0]; 代码1: #include <cstdio> #in ...

  3. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  4. ural 1150. Page Numbers

    1150. Page Numbers Time limit: 1.0 secondMemory limit: 64 MB John Smith has decided to number the pa ...

  5. URAL 1792. Hamming Code (枚举)

    1792. Hamming Code Time limit: 1.0 second Memory limit: 64 MB Let us consider four disks intersectin ...

  6. URAL 1002 Phone Numbers(KMP+最短路orDP)

    In the present world you frequently meet a lot of call numbers and they are going to be longer and l ...

  7. URAL 1012 K-based Numbers. Version 2(DP+高精度)

    题目链接 题意 :与1009一样,不过这个题的数据范围变大. 思路:因为数据范围变大,所以要用大数模拟,用java也行,大数模拟也没什么不过变成二维再做就行了呗.当然也可以先把所有的都进行打表,不过要 ...

  8. ural 1118. Nontrivial Numbers

    1118. Nontrivial Numbers Time limit: 2.0 secondMemory limit: 64 MB Specialists of SKB Kontur have de ...

  9. ural 1013. K-based Numbers. Version 3(动态规划)

    1013. K-based Numbers. Version 3 Let’s consider K-based numbers, containing exactly N digits. We def ...

随机推荐

  1. redis之有序集合类型(Zset)——排行榜的实现

    当数据库对排序支持的不是很好,可以利用redis有序集合排序 原文链接:http://blog.csdn.net/loophome/article/details/50373202

  2. microPython 的逗比报错的问题

    今天搞了一天,发现了各种问题,首先最终的解决办法就是重现刷固件!!!! 重刷固件就需要清除flash! cd C:\Users\sansong\AppData\Local\Programs\Pytho ...

  3. 【PostgreSQL-9.6.3】使用pg_settings表查看参数的生效条件

    PostgreSQL数据库的配置参数都在postgresql.conf文件中,此文件的目录为数据库的数据目录($PGDATA).这些参数有些是直接修改就可以生效,有些需要重启数据库才能生效,而有些根本 ...

  4. TF实战:(Mask R-CNN原理介绍与代码实现)-Chapter-8

    二值掩膜输出依据种类预测分支(Faster R-CNN部分)预测结果:当前RoI的物体种类为i第i个二值掩膜输出就是该RoI的损失Lmask 对于预测的二值掩膜输出,我们对每个像素点应用sigmoid ...

  5. struts2特殊符号替换

    今天用struts2做了一个小例子,结果发现个问题 action代码如下 private String table; public String execute(){ setName("pe ...

  6. 解决[disabled]="true"与formControlName冲突

    import { FormBuilder } from '@angular/forms'; form; constructor(private fb: FormBuilder) { this.form ...

  7. zabbix web监控

    深入浅出Zabbix 3.0 -- 第十章 Web 监控 http://www.mamicode.com/info-detail-1824545.html

  8. Python之UDP编程

    参考原文 廖雪峰Python教程 TCP是建立可靠连接,并且通信双方都可以以流的形式发送数据.相对TCP,UDP则是面向无连接的协议. 使用UDP协议时,不需要建立连接,只需要知道对方的IP地址和端口 ...

  9. jdbcTemplate传参使用Map或List

    List传参方式 举个例子 sql = "select * from table where id=? and param=?": sql中的参数要用?形式,然后使用list.ad ...

  10. LeetCode15——3Sum

    数组中找三个数和为0的结果集 1 // 解法一:先排序 然后固定一个值 然后用求两个数的和的方式 public static List<List<Integer>> three ...