UVA1583 - Digit Generator
来源:互联网 发布:如何在淘宝上卖鱼 资质 编辑:程序博客网 时间:2024/05/22 04:56
//UVA1583 - Digit Generator//題目:数x加上它各个位数之和得到一个y,x为y的最小生成元。求一个数的最小生成元//分析:打表,查表#include<stdio.h>#define MAXN 100005int ans[MAXN] = {0};int main(){int T, n;for(int i = 1; i<MAXN; i++){int x = i, y = i;while(x>0){ y += x%10; x /= 10;}//*1.该数的大小加上它本身已经越界即超过100000//*2.用更小的生成元替换原来的生成元,得到最小生成元if(ans[y] == 0 || i < ans[y])ans[y] = i;}scanf("%d",&T);while(T--){scanf("%d",&n);printf("%d\n",ans[n]);}return 0;}
0 0
- UVa1583 - Digit Generator
- UVA1583 - Digit Generator
- uva1583 - Digit Generator
- uva1583-digit generator
- UVA1583 UVALive3355 Digit Generator
- UVA1583 - Digit Generator
- UVa1583-Digit Generator
- Digit Generator—UVa1583
- UVa1583——Digit Generator
- UVa1583 Digit Generator另一种解法
- UVA1583 - Digit Generator(生成元,打表)
- Digit Generator, ACM/ICPC Seoul 2005, UVa1583
- [Digit Generator, ACM/ICPC Seoul 2005, UVA1583]
- 生成元(Digit Generator,ACM/ICPC Seoul 2005, UVa1583)
- 生成元(Digit Generator, ACM/ICPC Seoul 2005, UVa1583)
- uva1583 Digit Generator && uva1584 Circular Sequence(水)
- UVa1583 - Digit Generator 生成元 (java版本)
- 最小生成元 (Digit Generator, ACM/ICPC Seoul 2005, UVa1583)
- C++中string构造函数的解析
- 大数据开发----Fabric(入门篇)
- 项目实践积累我的工具类——CommonUtils
- android中intent-filter的分析和具体使用用例
- 蓝桥杯 基础练习01 Java实现
- UVA1583 - Digit Generator
- set
- H264分析源码学习之结构体篇——h264_stream_t结构体
- 【算法系列-11】回溯算法-八皇后
- sql联合查并统计子表符合的总数
- HDU 3639 Tarjan + 缩点 + 反建图 + 搜索
- hyper-v查看虚拟机启动顺序
- 异常小记
- free() invalid next size异常