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. Intellij使用心得(四) -- 导入Eclipse的代码格式化文件

    https://my.oschina.net/flashsword/blog/137598

  2. 转载pcb设计详细版

    http://www.51hei.com/bbs/dpj-52438-1.html 详细的altium designer制作PCB步骤,按照步骤一步步的学习就会自己制作PCB模型 目 录 实验三  层 ...

  3. 10.5 集合ArrayList 和 io流

    1.ArrayListToFile package day10_io_fileWrite_Read.arraylist_tofile; import java.io.BufferedWriter; i ...

  4. CAD设置背景图片

    把图片作为背景图片可见但是不能编辑操作. 主要用到函数说明: _DMxDrawX::DrawImageToBackground 绘光栅图到背景.详细说明如下: 参数 说明 BSTR sFileName ...

  5. Ubuntu搭建LAMP开发环境

    1.安装Apache sudo apt-get install apache2 测试: 浏览器访问 (如:http://localhost),出现It Works!网页. 查看状态: service ...

  6. 使用cloudcompare进行对比轨迹及评价

    0.预备知识: 我的系统是Ubuntu 16.04. 在其他发行版中,可能需要先安装snap(如有必要,请参阅相应的文档).快照发布在3个频道:“稳定”,“测试版”和“边缘”.“稳定版”和“测试版”频 ...

  7. 关于DOS-BOX的使用方法

    将MASM文件夹里的全部文件拷贝到一个目录下,比如E:\masm下,然后将这个目录挂着为DOSBox的一个盘符下,挂载命令为 Mount c e:\masm 切换到E盘 然后编译,运行

  8. kdump机制和crash常见使用

    kdump简介 kdump是系统崩溃的时候,用来转储运行内存的一个工具. 系统一旦崩溃,内核就没法正常工作了,这个时候将由kdump提供一个用于捕获当前运行信息的内核, 该内核会将此时内存中的所有运行 ...

  9. manacher(马拉车)算法

    断断续续地看了两天的马拉车算法,可算是给搞明白了(贼开心),这算是自己搞懂的第一个算法了(23333333333333)这个算法照目前自己的理解来看,貌似就只能求个字符串中的回文串(接触这个算法是要求 ...

  10. Python爬虫常用库安装

    建议更换pip源到国内镜像,下载会快很多:https://www.cnblogs.com/believepd/p/10499844.html requests pip3 install request ...