解题思路:使用集合容器,里面的元素无序且不重复
注意事项:
参考代码:
import java.util.HashSet; public class Main { public static void main(String[] args) { HashSet<Integer> price = new HashSet<Integer>(); for(int i = 0; i <= 4; i++) { for(int j = 0; j <= 3; j++) { if(3*i+5*j != 0) { price.add(3*i+5*j); } } } System.out.println(price.size()); } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:552 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:805 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:544 |
多输入输出练习1 (C语言代码)浏览:1178 |
printf基础练习2 (有点不明白)浏览:837 |
C语言训练-阶乘和数* (C语言代码)-------- 呆板写法浏览:1345 |
求组合数 (C语言代码)浏览:1153 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:549 |
wu-理财计划 (C++代码)浏览:827 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:326 |