题解 | #百钱买百鸡问题#
百钱买百鸡问题
http://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int k=sc.nextInt(); solver(); } public static void solver(){ for(int x=0;x<=20;x++){ for(int y=0;y<=33;y++){ int z=100-x-y; if(5*x+3*y+z/3.0==100){ System.out.printf("%d %d %d",x,y,z); System.out.println(); } } } } }