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. 简单谈谈MySQL中的int(m)

    转载地址:https://www.jb51.net/article/93760.htm 设置int型的时候,需要设置int(M),以前知道这个M最大是255,但是到底应该设置多少并没有在意.注意zer ...

  2. JavaScript(七)数组

    Array类型 1.创建数组 字面量 var arr = [];//不要在低版本的浏览其中创建字面量的时候最后 //一个item后面加 逗号 低版本会 再新建一个空的item 构造函数 var arr ...

  3. Table标题行冻结,数据行滚动的一种方式

    这段时间在做Table标题行冻结,数据行滚动,虽然能实现,但也遇到一些问题,记录下来. 首先说说实现,实现其实不难,估计很多人都能想象出来,那就是标题行与内容行分离.我是这么做的,用两个表格,一个只有 ...

  4. 项目经验——Sql server 数据库的备份和还原____还原数据库提示“介质集有2个介质簇,但只提供了1个。必须提供所有成员” .

    在对数据库备份与还原的过程中,我遇到一个问题“介质集有2个介质簇,但只提供了1个.必须提供所有成员”,下面详细的介绍一下遇到问题的经过与问题解决的方法! 一.备份与还原遇到的问题描述与解决方法: 前两 ...

  5. cideogniter部署到阿里云服务器出现session加载错误

    A PHP Error was encounteredSeverity: WarningMessage: mkdir() [function.mkdir]: Invalid argumentFilen ...

  6. Win7 下 PB (PowerBuilder) Insert Control 崩溃的解决办法

    环境: WIN7 x86  PB8.0, x64系统目录不同,不过也可以试试 Insert -> OLE... -> Insert Control  - 崩溃 如果网上提供的办法解决不了你 ...

  7. [HNOI2006]最短母串 (AC自动机+状压)

    Description 给定n个字符串(S1,S2,„,Sn),要求找到一个最短的字符串T,使得这n个字符串(S1,S2,„,Sn)都是T的子串. Input 第一行是一个正整数n(n<=12) ...

  8. Vue.js 是什么

    Vue.js 是什么 Vue.js(读音 /vjuː/, 类似于 view) 是一套构建用户界面的 渐进式框架.Vue 采用自底向上增量开发的设计. Vue 的核心库只关注视图层. 单页应用:Vue ...

  9. JS函数assign

    Object函数提供了一个叫做assign的函数,用来合并多个对象. Object.assign(...): 你可以传递多个对象给该函数,这些对象中的自有且可枚举的属性,会被拷贝给第一个对象. var ...

  10. 牛客多校Round 4

    Soved:3 rank:133 A.Ternay String 欧拉降幂一下 但是反复求phi会超时 但mod是同一个就可以记忆化一下 #include <bits/stdc++.h> ...