Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
1A, 贴代码#include<iostream> using namespace std; #define MAX 100 char Number[MAX]; int temp[MAX]; int main() { while(scanf("%s", &Number) != EOF) { int len = strlen(Number); memset(temp, 0, sizeof(temp)); int pos = 0; for(int i = len - 1; i >= 2; i --) { int s = 0, j = 0; temp[0] = Number[i] - '0'; while(j <= pos || s != 0) { s = s * 10 + temp[j]; temp[j] = s/8; s%= 8; j ++; } pos = j - 1; } printf("%s [8] = 0.", Number); for(int k = 1; k <= pos; k ++) printf("%d", temp[k]); printf(" [10]\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator