LanQiaoTestCodes/积分之谜.java

26 lines
883 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package LanQiaoOJ;
/*积分之谜
* 题目描述
本题为填空题,只需要算出结果后,在代码中使用输出语句将所填结果输出即可。
小明开了个网上商店,卖风铃。共有 3个品牌ABC 为了促销,每件商品都会返固定的积分。
小明开业第一天收到了三笔订单:
第一笔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 ;
}
}
}
}
}
}