hdu 4278 Faulty Odometer(进制转换)
十进制转八进制的变形:
#include<stdio.h> int main() { int n; while(scanf("%d",&n)!=EOF&&n) { int sum=0; int m=n; int ret=1,x; while(n) { x=n%10; if(x>8)x--; if(x>3)x--; sum+=ret*x; ret*=8; n/=10; } printf("%d: %d\n",m,sum); } return 0; }