参考代码:
import java.util.Scanner; class Thuodan{ String name; double money; int num; } public class 提货单 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub //1597: [蓝桥杯][算法训练VIP]提货单 Scanner scanner=new Scanner(System.in); int n=scanner.nextInt(); Thuodan [] t1=new Thuodan[n]; double jia=0; for (int i = 0; i < t1.length; i++) { t1[i]=new Thuodan(); t1[i].name=scanner.next(); t1[i].money=scanner.nextDouble(); t1[i].num=scanner.nextInt(); } for (Thuodan thuodan : t1) { jia+=thuodan.money*thuodan.num; } System.out.println(String.format("%.6f", jia)); } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:645 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:590 |
1025题解浏览:796 |
A+B for Input-Output Practice (C语言代码)浏览:505 |
循环入门练习5 (C语言代码)浏览:908 |
杨辉三角 (C语言代码)浏览:505 |
数组与指针的问题浏览:760 |
A+B for Input-Output Practice (I) (C语言代码)浏览:451 |
众数问题 (C语言代码)浏览:717 |
小O的乘积 (C语言代码)浏览:1062 |