26岁开始过生日,到33岁
/** * @author Administrator *生日蜡烛某君从某年开始每年都举办一次生日party,并且每次都要吹熄与年龄相同根数的蜡烛。现在算起来,他一共吹熄了236根蜡烛。请问,他从多少岁开始过生日party的? */public class candle {public static void main(String[] args) {// TODO Auto-generated method stubint re=0;for(int j=1;j<=100;j++){int count=0;int tem=0;for(int i=j;i<=100;i++){tem=i+tem;count++;if(tem==236){re=j;System.out.PRintln(re);System.out.println(tem);System.out.println(count);break;}}} }}
新闻热点
疑难解答