java百元の鳥の問題

508 ワード

/**
 * 
 *       :  5   ,  3   ,3   1 ,
 *    100  , 100  ,    ,     ,  ,  ,    。 
 *
 */
public class Demo{
		
	public static void main(String[] args) {
		int x;
		int y;
		int z;
		for(x = 0 ; x <= 20 ; x++) {
			for(y = 0; y <= 33; y++) {
				z = 100 - x - y ;
					if(x*5+y*3+z/3==100  && z %3 == 0) {
						System.out.println("  :"+x+" "+"\t"+"  : "+y+" "+"\t"+"  "+z+" ");
					}
				
			}
		}
	}

}