题解 | #百钱买百鸡问题#
百钱买百鸡问题
https://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b
import java.util.*; public class Main { public static void main(String[] args) { Scanner fzhinput = new Scanner(System.in); int zs = fzhinput.nextInt(); int jw=0,jm=0,jc=0; for(int i=0;i<=20;i++){ for(int j=0;j<34;j++){ for(int n=0;n<=100;n++){ if(5*i+3*j+n/3==100&&i+j+n==100&&n%3==0){ System.out.println(i+" "+j+" "+n); } } } } } }