题目1045:百鸡问题
参考代码:
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String arg[]){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
double money=sc.nextDouble();
for(int i=0;i<=money/5;i++)
for(int j=0;j<=money/3;j++)
{
if((5*(double)i+(double)j*3+((double)(100)-(double)i-(double)j)*1/3)<=money)
System.out.println("x="+i+",y="+j+",z="+(100-i-j));
}
}
}
}<strong>
</strong>