26 lines
883 B
Java
26 lines
883 B
Java
package LanQiaoOJ;
|
||
/*积分之谜
|
||
* 题目描述
|
||
本题为填空题,只需要算出结果后,在代码中使用输出语句将所填结果输出即可。
|
||
小明开了个网上商店,卖风铃。共有 3个品牌:A,B,C 为了促销,每件商品都会返固定的积分。
|
||
小明开业第一天收到了三笔订单:
|
||
第一笔:3 个 A +7个B +1个C,共返积分:315。
|
||
第二笔:4 个 A +10个B+1个 C,共返积分:420。
|
||
第三笔:A + B + C,共返积分 ........
|
||
你能算出第三笔订单需要返积分多少吗?*/
|
||
public class 积分之谜 {
|
||
public static void main(String[] args) {
|
||
int a,b,c;//分别表示A B C三个品牌返回的固定积分
|
||
for(a=1;a<420;a++) {
|
||
for (b = 1; b<420; b++) {
|
||
for (c = 1; c<420; c++) {
|
||
if (3 * a + 7 * b + c == 315 && 4 * a + 10 * b + c == 420) {
|
||
System.out.println(a+b+c);
|
||
return ;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|