码迷,mamicode.com
首页 > 编程语言 > 详细

班上一个哥们java脑残的笔试题1,2,3,4等于12可以重复3分钟答出来

时间:2014-06-08 16:51:26      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:c   class   blog   code   java   a   

package com.hao947;

public class hao947 {

	public static void main(String[] args) {
		int a = 1;
		int b = 2;
		int c = 3;
		int d = 4;
		int count = 0;
		for (int i = 0; i <= 12; i++) {
			for (int j = 0; j <= 6; j++) {
				for (int k = 0; k <= 4; k++) {
					for (int l = 0; l <= 3; l++) {
						int sum = (a * i + b * j + c * k + d * l);
						if (sum == 12) {
							count++;
						}
					}
				}
			}
		}
		System.out.println(count);
	}
}

班上一个哥们java脑残的笔试题1,2,3,4等于12可以重复3分钟答出来,布布扣,bubuko.com

班上一个哥们java脑残的笔试题1,2,3,4等于12可以重复3分钟答出来

标签:c   class   blog   code   java   a   

原文地址:http://blog.csdn.net/hao947_hao947/article/details/28682971

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!