UVA solution 471 - Magic Numbers - Solution in C,C++ - Volume 4
UVA Online Judge Solution 471 - Magic Numbers | Volume 4
UVA Problem Link - 471 - Magic Numbers
Problem Name: 471 - Magic Numbers Solution
Problem Number : UVA - 471 - Magic Numbers Solution
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C/C plus plus
UVA Solution 471 - Magic Numbers Code in C/CPP:
#include <stdio.h> const long long limit = 9876543210LL; int Check(long long n) { char digit[10] = {0}, s[11], i = 0; sprintf(s, "%lld", n); while(s[i]) { digit[s[i]-'0']++; if(digit[s[i]-'0'] == 2) return 0; i++; } return 1; } int main() { int T; long long n, m, i; scanf("%d", &T); while(T--) { scanf("%lld", &n); for(i = 1; n*i <= limit; i++) { m = n*i; if(Check(i) && Check(m)) printf("%lld / %lld = %lld\n", m, i, n); } if(T) puts(""); } return 0; }
Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list, UVA 471 - Magic Numbers code in C, UVA Magic Numbers code in C++, UVA 471 - Magic Numbers solution in C, UVA 471 solution
No comments:
Post a Comment