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. C语言常见问题总结

    1.多次运行程序 解决方法: 错误原因是,已经编译运行出一个exe,没有关闭此exe,又点击编译运行. 应该将之前运行出的exe关闭,再来运行代码 2.单精度类型和双精度类型如何区分使用... 解决方 ...

  2. 使用QTP录制自带Flight小实例

    1.双击打开QTP10.0,启动过程中测试类型选择“WEB”. 2.进入主界面,New——Test,新建一个测试用例. 3.点击Record按钮,Record and settings对话框中,可以选 ...

  3. 生成Nuget 源代码包来重用你的Asp.net MVC代码

    ASP.NET 开发人员有时会陷入一种困境:想要重用以前写过的东西,如一些具有完整功能的Web页面+后台逻辑, 往往不那么直接了当,因此很不爽.经常采用的方式是:找到以前写过的项目,从中挑出来一些有用 ...

  4. UVM基础之------uvm_port_base

    Port Base Classes    uvm_port_component_base    This class defines an interface for obtaining a port ...

  5. 北大ACM(POJ1017-Packets)

    Question:http://poj.org/problem?id=1017 问题点:贪心. Memory: 224K Time: 32MS Language: C++ Result: Accept ...

  6. 【alert(1) to win】不完全攻略

    alert(1) to win 一个练习XSS的平台,地址:https://alf.nu/alert1 Warmup 给出了一段JavaScript代码 function escape(s) { re ...

  7. LPSTR LPCTSTR

    UNICODE:它是用两个字节表示一个字符的方法.比如字符'A'在ASCII下面是一个字符,可'A'在UNICODE下面是两个字符,高字符用0填充,而且汉字'程'在ASCII下面是两个字节,而在UNI ...

  8. 基于APE物理引擎的管线容积率计算方法

    容积率一般应用在房地产开发中,是指用地范围内地上总建筑面积与项目总用地面积的比值,这个参数是衡量建设用地使用强度的一项非常重要的指标.在其他行业,容积率的计算也非常重要,如产品利用率.管道使用率等等. ...

  9. Python函数: any()和all()的用法

    版权声明:本文为博主原创文章,未经允许不得转载 引子 平常的文本处理工作中,我经常会遇到这么一种情况:用python判断一个string是否包含一个list里的元素. 这时候使用python的内置函数 ...

  10. radis入门

    redis介绍 是远程的,有客户端.服务端 存内存,吃内存 应用场景 缓存 队列 list操作 push pop 数据存储[根据redis硬盘持久化的机制,这里不展开] 5种数据类型 string 字 ...