使用栈实现进制转换(java大数进制转换)

Problem A: 使用栈实现进制转换

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 35  Solved: 19
[Submit][Status][Web Board]

Description

使用栈将一个很长(>30)的十进制数转换为二进制数

Input

若干个很长的十进制数

每行一个

Output

转换为二进制,每行输出一个

Sample Input

123456789012345678901234567890
753951684269875454652589568545854758545824

Sample Output

1100011101110100100001111111101101100001101110011111000001110111001001110001111110000101011010010
10001010011110101010001101001000100100100000101001011010001010101001000100111101011001110001000111110010001000101101111110110110100110100000

HINT

import java.math.BigInteger;
import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		BigInteger a;
		Scanner cin=new Scanner(System.in); 
		while (cin.hasNext()) {
			a=cin.nextBigInteger();
			System.out.println(a.toString(2));
			
		}
	}

}


阅读更多
换一批

没有更多推荐了,返回首页