- 综合讨论区
- 帖子详情
3
回复
-
十二行代码,四分钟排错,第一次提交8分,第二次提交满分通过。哈哈哈~~!话说考试的时候与平时确实不一样,心里蛮紧张的!
-
<p>我觉得我们的代码应该一样</p>
-
<p><code class="brush:java;toolbar:false" >public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int i = in.nextInt(); if(i>0) { int cnt1 = 0; while(i/2 != 0) { i /= 2; cnt1 ++; } System.out.println(32-cnt1-1); }else if (i==0) { System.out.println(32); } } }</code>我已经提交了,8分,请帮看一下,还有哪里考虑不到呢?</p><p>我考虑的是输入的i>0,和i=0,两种情况.</p>
添加评论 -