| 6727064 |
2012-09-09 17:39:14 |
Accepted |
4278 |
0 ms |
212 K |
853 B |
G ++ |
If Code Error. Please note ^ Analysis: It is equivalent to converting decimal to octal... View code
1 # Include <cstdio> 2 # Include <cstring> 3 # Include <algorithm> 4 5 Using Namespace STD; 6 7 Int N, M, L, ans; 8 Int A [ 20 ]; 9 Int P [ 11 ]; 10 11 Int Main () 12 { 13 P [ 0 ] = 1 ; 14 For ( Int I = 1 ; I < 11 ; ++ I) P [I] = P [I- 1 ] * 8 ; 15 While (Scanf ( " % D " , & N) = 1 ){ 16 If (N = 0 ) Break ; 17 L = 0 ; 18 M = N; 19 While (N ){ 20 A [L ++] = n % 10 ; 21 N/= 10 ; 22 } 23 For ( Int I = 0 ; I <L; ++ I ){ 24 If (A [I] = 4 ) A [I] = 3 ; 25 Else If (A [I] = 5 ) A [I] = 4 ; 26 Else If (A [I] = 6 ) A [I] = 5 ; 27 Else If (A [I] = 7 ) A [I] = 6 ; 28 Else If (A [I] = 9 ) A [I] = 7 ; 29 } 30 Ans = 0 ; 31 For ( Int I = l- 1 ; I> = 0 ;-- I) 32 Ans + = A [I] * P [I]; 33 Printf ( " % D: % d \ n " , M, ANS ); 34 35 } 36 37 Return 0 ; 38 }