hdu 1390 Binary Numbers
2011-09-15 12:15
281 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1390
/* 2011-9-15 author:BearFly1990 */ package acm.hdu.tests; import java.io.BufferedInputStream; import java.util.Scanner; public class HDU_1390 { public static void main(String[] args) { Scanner in = new Scanner(new BufferedInputStream(System.in)); int t = in.nextInt(); while(t-- > 0){ int n = in.nextInt(); String str = Integer.toBinaryString(n); int[] arry = new int[str.length()]; int index = 0; //System.out.println(str); for(int i = 0 ,j = str.length()-1; j >= 0 ; i++,j--){ if(str.charAt(j) == '1'){ arry[index++] = i; } } System.out.print(arry[0]); for(int i = 1 ; i < index; i++){ System.out.print(" "+arry[i]); } System.out.println(); } } }
相关文章推荐
- 杭电Hdu 1390 Binary Numbers
- hdu 1390 Binary Numbers
- HDU 1390 Binary Numbers
- HDU 1390 Binary Numbers
- HDU1390_Binary Numbers【水题】【位运算】
- 【HDU】1390 Binary Numbers
- HDU 1390 Binary Numbers
- hdu 1390 Binary Numbers
- hdu1390-Binary Numbers
- HDU 1390 || ZOJ 1383 Binary Numbers
- HDU 1390 Binary Numbers(数学题)
- HDU1390 ZOJ1383 Binary Numbers【水题+输入输出】
- Binary Numbers 1390 HDU
- 杭电ACM1390——Binary Numbers
- hdu 1390
- HDU Binary Numbers 1390(转换+统计)
- 1390.Binary Numbers
- hdu 1390
- hdu 1390
- hdu 1390