URAL 2031. Overturned Numbers (枚举)
来源:互联网 发布:潮州php 编辑:程序博客网 时间:2024/06/06 08:34
2031. Overturned Numbers
Time limit: 1.0 second
Memory limit: 64 MB
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 ofn 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
2
11 01
99
Glupenky PierreProblem 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;}
0 0
- URAL 2031. Overturned Numbers (枚举)
- timus 2031. Overturned Numbers
- URAL 2070 Interesting Numbers (素数枚举)
- H - Overturned Numbers-坑爹水题
- URAL 1586 Threeprime Numbers (数位DP)
- Ural 1009 K-based Numbers(DP)
- Ural 1586 Threeprime Numbers(DP)
- ural 1009. K-based Numbers(dp)
- ural 1586. Threeprime Numbers(dp)
- URAL 2070 Interesting Numbers(数学)
- URAL 2070 Interesting Numbers(数论)
- ural 2070 Interesting Numbers(数论基础)
- ACDream 1417 - Numbers(枚举)
- (枚举)HDU 5522 Numbers
- USACO-Runaround Numbers(枚举)
- ZOJ 3987 Numbers(枚举)
- ural 1002 Phone numbers
- ural 1002 phone numbers
- 微信分享
- JavaSE_基础库类_简介
- 如何在桌面版 Ubuntu 中用命令行更改系统代理设置
- Android五天乐(第一天)开发环境的部署,开发流程与调试
- JavaSE_基础库类_String类
- URAL 2031. Overturned Numbers (枚举)
- vs qt中增加png图标
- 敏捷项目软件管理与开发
- FFmpeg架构之I/O模块分析
- 【读书笔记:C++ primer plus 第六版 中文版】第7章 函数---C++的编程模块
- 日志框架实现实时修改,实时生效,具体框架思路(4)
- [深入浅出Cocoa]Block编程值得注意的那些事儿
- 关于打开Android应用多次点击重复加载数据的问题。
- 关闭ssh的自动启动(ubuntu 12.04)