解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(),x=1,shendu=1,max_shendu=-1; int sum=0,max=Integer.MIN_VALUE; while(x<=n){ sum=0; for(int i=1;i<=Math.pow(2, shendu-1);i++){ int A=sc.nextInt(); sum+=A; x++; if(x>n) break; } if(max<sum){ max=sum; max_shendu=shendu; } shendu++; } System.out.print(max_shendu); } }
0.0分
0 人评分
C语言训练-计算1~N之间所有奇数之和 (C语言代码)浏览:647 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:1055 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:685 |
1009题解浏览:746 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:555 |
1118(求助_已解决)浏览:329 |
程序员的表白 (C语言代码)浏览:592 |
交换Easy (C语言代码)浏览:761 |
复数求和 (C语言代码)浏览:920 |
简单的a+b (C语言代码)浏览:553 |