2016-02-28 Problem Solving►UVa UVa 11185 - Ternary Contents 1. Problem2. Solution3. Code Problem題目網址 轉成 3 進位。 SolutionCodeUVa 11185UVa 11185 - Ternary1234567891011121314151617181920212223242526272829#include<cstdio>int main(){ int n; while (scanf("%d", &n) && n >= 0) { if (!n) { puts("0"); continue; } int ternary[20] = {0}, count = 0; while (n) { ternary[++count] = n % 3; n /= 3; } while (count) printf("%d", ternary[count--]); putchar('\n'); } return 0;} Newer UVa 11069 - A Graph Problem Older UVa 12626 - I Love Pizza