题解 | #百钱买百鸡问题#【三元一次方程】

百钱买百鸡问题

https://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        in.nextInt();
        for (int i = 0; i < 100 / 7; i++) {
            if ((100-7*i)%4 == 0) {
                System.out.printf("%d %d %d\n", i, (100-7*i)/4, 100 -i-((100-7*i)/4));
            }
        }
    }
}

全部评论

相关推荐

03-29 14:19
门头沟学院 Java
你背过凌晨4点的八股文么:加油同学,人生的容错率很高,只是一个暑期罢了,后面还有很多机会!
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务