package com.zhenlvwang.interview;
/**
* 走台阶:
* 如果每次走2步,最后剩下1步
* 如果每次走3步,最后剩下2步
* 如果每次走4步,最后剩下3步
* 如果每次走5步,最后剩下4步
* 如果每次走6步,最后剩下5步
* 如果每次走7步,刚好走完
* @author yangjianzhou
*
*/
public class Problem4 {
public static void main(String[] args) {
boolean bool =true;
int xx =7;
while(bool){
if(xx%7==0&&xx%2==1&&xx%3==2&&xx%4==3&&xx%5==4&&xx%6==5){
bool = false;
}
xx = xx +7;
}
System.out.println(xx-7);
}
}
运行结果:
119