当前位置: 代码迷 >> 综合 >> HDOJ 1390 Binary Numbers(水题)
  详细解决方案

HDOJ 1390 Binary Numbers(水题)

热度:74   发布时间:2023-10-21 19:30:53.0

HDACM1390

练英语…

import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc = new Scanner(System.in);int d = sc.nextInt();while(d-->0){int n = sc.nextInt();int count = 0;boolean isFirst = true;while (n>0) {if (n%2==1) {if (!isFirst) {System.out.print(" ");}System.out.print(count);isFirst = false;}n /= 2;count++;}System.out.println();}}
}
  相关解决方案