Problem Description
Enter an octal string, convert it to an equivalent decimal string, and output it in the PRINGF%s format.
Input
First, a positive integer t is entered, indicating that there is a T set of test data (1<= T <= 10010).
Next T line, one string per line, representing an octal integer (this integer is no more than 20 bits).
Output
For each test data, output the corresponding decimal string. One line per string.
Sample Input
11732
Sample Output
986
HINT
Note: The given octal number may be large, with a long long
#include <stdio.h>#include<string.h>#include<stdlib.h>Long LongMishu (intj) { Long Longres =1; for(;j>0; j--) {res*=8; } returnRes;}intMain () {inti,j,k,m; Long LongN; while(SCANF ("%d", &m)! =EOF) { for(k=0; k<m;k++) {n=0; Chars[ +]; scanf ("%s", s); for(I=strlen (s)-1, j=0; i>=0; I--, J + +) {n+ = (s[i]-'0')*Mishu (j); } printf ("%lld\n", N); } } return 1;}
Wuhan University of Science and Technology acm:1008: Chinese Edition C language Programming tutorial (second edition) Exercise 6.14