//輸入一個int型的正整數,計算出該int型數據在內存中存儲時1的個數。

    //輸入一個int型的正整數,計算出該int型數據在內存中存儲時1的個數。
    
      public static void main(String[] args) {
        
         Scanner  sc=new Scanner(System.in);
         
          while (sc.hasNext()){
            boolean n=sc.hasNext();
            int count=0;
            while(n!=0) {
                count++;
                n=n%(n-1);
            }
             System.out.println(count);
             
         }
    }
}
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章