http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2126
中譯
http://luckycat.kshs.kh.edu.tw/homework/q11185.htm
#include "stdio.h" int main() { int N; while( scanf(" %d",&N) ) { int q[1000],i = 0,j; if( N < 0 ) break; if( N == 0) q[0] = 0; while( N > 0 ) { q[i] = N % 3; N = N / 3; if( N == 0 ) break; i++; } for(j = i;j >= 0;j--) { printf("%d",q[j]); } printf("\n"); } return 0; }
沒有留言:
張貼留言