Digit Generator UVa1583
2018-03-14 16:21
309 查看
#include <iostream> using namespace std; //求一个数的长度 int lent(int n) { if (n < 10) return 1; return 1 + lent(n / 10); } #define MIN(n) (lent(n)) * 9 int main(void) { int n; while (cin >> n) { bool isFinded = false; for (int i = MIN(n); i < n; i++) { int RS = i; int temp = i; while (temp > 0) { RS += temp % 10; temp /= 10; } if (RS == n) { isFinded = true; cout << i << endl; break; } } if(!isFinded) cout << 0 << endl; } }
我偏不用查表法,打我啊~
相关文章推荐
- UVA-1583Digit Generator
- UVA 1583(p52)----Digit Generator
- uva 1583 B - Digit Generator (暴力)
- 算法竞赛 例3-5生成元(Digit Generator,ACM/ICPC Seoul 2005,UVa1583)
- 最小生成元 (Digit Generator, ACM/ICPC Seoul 2005, UVa1583)
- uva_1583_Digit Generator
- UVA - 1583 Digit Generator
- UVA-1583 - Digit Generator
- UVA 1583 Digit Generator(最小生成元+打表)
- 生成元(Digit Generator, ACM/ICPC Seoul 2005, UVa1583)
- 生成元(Digit Generator, ACM/ICPC Seoul 2005, UVa1583)
- UVa 1583 - Digit Generator
- 生成元(Digit Generator, ACM/ICPC Seoul 2005, UVa1583)
- uva1583 - Digit Generator
- UVa 1583 Digit Generator --- 水题+打表
- Digit Generator—UVa1583
- uva 1583 Digit Generator
- UVA1583 - Digit Generator
- UVa 1583-Digit Generator-AC
- UVa 1583:Digit Generator