1.13.3

Source: Internet
Author: User

03: Octal Decimal
Total time limit:
1000ms
Memory Limit:
65536kB
Describe

Octal finite decimals can be represented precisely in decimal finite decimals. For example, 0.75 in octal is equal to 0.963125 (7/8 + 5/64) in decimal. All octal decimals with a post-decimal number of n can be represented as decimal decimals with no more than 3n decimal places.

Your task is to write a program that converts the octal decimal between (0,1) into decimal decimals.

Input
a row that contains an octal decimal. Each decimal form is 0.d1d2d3 ... dk, here di is the octal number 0 ... 7,DK is not equal to 0 and is known to be 0 < K < 15.
Output
Enter a line of the following form

0.d1d2d3...dk [8] = 0.d1d2d3 ... Dm [10]

Here on the left is the octal decimal number entered, and the right is an equal decimal decimal. The end of the output must not be 0, which means DM is not equal to 0. Note the space position.
Sample input
`0.75`
Sample output
`0.75 [8] = 0.953125 [10]`
Source
questions translated from Southern African 2001
`1#include <cstring>2#include <cstdio>3 using namespacestd;4 intMain () {5 intl,i;6 Chars[ -];7 DoubleN;8scanf"%s", s);9n=0;TenL=strlen (s); One  for(i=l-1;i>1; i--){ An+=s[i]-'0'; -N/=8.0; - } theprintf"%s [8] =%.45g [ten]", s,n); - return 0; -}`

1.13.3

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• Sales Support

1 on 1 presale consultation

• After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.