UVa1583——Digit Generator
2015-09-20 15:08
260 查看
水题。
AC的代码:
AC的代码:
#include <iostream> #include <cstring> using namespace std; const int MAX = 105005; int ans[MAX]; int main() { int t, n, i; memset(ans, 0, sizeof(ans)); for(i = 1; i < MAX; i++) { int x = i, y = i; while(x) { y += x % 10; x /= 10; } if(ans[y] == 0 || i < ans[y]) ans[y] = i; } while(cin >> t) { while(t--) { cin >> n; cout << ans << endl; } } return 0; }
相关文章推荐
- Codeforces 451E Devu and Flowers(容斥原理)
- How to install and configure Azure PowerShell
- Android 开源框架xUtil
- 《等价类划分》
- 给numpy矩阵添加一列
- 研磨数据结构与算法-09快速排序
- ToolBar(5.0以后替代ActionBar)
- java常用类
- Visual phenomenon
- 欢迎使用CSDN-markdown编辑器
- UVa340——Master-Mind Hints
- UVA 1364 - Knights of the Round Table (获得双连接组件 + 二部图推理染色)
- Eclispe保存时自动格式化
- Io流的层次结构
- http协议 知识点
- Hadoop笔记之Hive安装过程
- 递归问题
- 计算器
- Hello Pomleo浅析之 game-server
- 研磨数据结构与算法-08希尔排序