小明付了70元小红付了28元小王付了690元,小明小红给小王多少钱
1个回答
2018-08-12
展开全部
设足球有x个,篮球有y个。 4x + 5y = 690 这里只考虑价钱为整数,否则无限种情况了。我写了个程序,你也不需要看懂,答案在下面。 public class test { public static void main(String[] args) { for (int x = 1; x < 690; x ++) { for (int y = 1; y < 690; y++) { if ((4 * x) + (5 * y) == 690) { System.out.println("x = " + x +" ,y = " + y); } } } } } x = 5 ,y = 134 x = 10 ,y = 130 x = 15 ,y = 126 x = 20 ,y = 122 x = 25 ,y = 118 x = 30 ,y = 114 x = 35 ,y = 110 x = 40 ,y = 106 x = 45 ,y = 102 x = 50 ,y = 98 x = 55 ,y = 94 x = 60 ,y = 90 x = 65 ,y = 86 x = 70 ,y = 82 x = 75 ,y = 78 x = 80 ,y = 74 x = 85 ,y = 70 x = 90 ,y = 66 x = 95 ,y = 62 x = 100 ,y = 58 x = 105 ,y = 54 x = 110 ,y = 50 x = 115 ,y = 46 x = 120 ,y = 42 x = 125 ,y = 38 x = 130 ,y = 34 x = 135 ,y = 30 x = 140 ,y = 26 x = 145 ,y = 22 x = 150 ,y = 18 x = 155 ,y = 14 x = 160 ,y = 10 x = 165 ,y = 6 x = 170 ,y = 2 以上是所有可能的情况了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询