题解 | #百钱买百鸡问题#
百钱买百鸡问题
http://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b
三重循环yyds
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()){
int n = scan.nextInt();
for(int i = 0; i<=20; i++){
for(int j = 0; j<=33; j++){
for(int k = 0; k<=300; k+=3){
if(i+j+k==100 && 5*i+3*j+k/3 == 100){
System.out.print(i+" "+j+" "+k);
System.out.println("");
}
}
}
}
}
scan.close();
}
}