Submit | All submissions | Best solutions | Back to list |
DEC_BIN - Terminating or Non-Terminating |
Binary representation of some decimals are terminating and some gives repeating decimal,for example the binary representation 7(111) is terminating but 7.2(111.0011001100110011...) is non terminating.
Given a number you have to determine whether it's binary representation is terminating or not.
Score is the length of the source.
Input
Each line of input presents a single test case: a string of decimal digits, each of them is no longer than 500 characters long.There will be no extraneous spaces in the input.
The input ends on EOF.
Output
Output “1" or “0” for terminating and non-terminating respectively.
Example
Input:
457788832157.625
Output:
1
Added by: | :(){ :|: & };: |
Date: | 2010-06-29 |
Time limit: | 0.302s |
Source limit: | 1000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 CPP C99 |
hide comments
2014-05-07 18:14:31 Mitch Schwartz
I wrote about this before but the comment was lost: Note that the input data for this problem uses "\r\n" newlines. Last edit: 2014-05-17 01:58:59 |