参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner ss=new Scanner(System.in); double a[]={28.9,32.7,45.6,78,35,86.2,27.8,43,56,65}; int cnt[]=new int[10]; double sum=0; for(int i=0;i<10;i++) { cnt[i]=ss.nextInt(); sum+=a[i]*cnt[i]; } System.out.printf("%.1f",sum); } }
0.0分
0 人评分