爱因斯坦曾经提出过这样一道有趣的数学题:有一个长阶梯,若每步上2阶,最后剩下1阶;若每步上3阶,最后剩2阶;若每步上5阶,最后剩下4阶;若每步上6阶,最后剩5阶;只有每步上7阶,最后刚好一阶也不剩。请问该阶梯至少有多少阶
int i = 7;
int times = 1000;
while ((i % 2 != 1 || i % 3 != 2 || i % 5 != 4 || i % 6 != 5) && i < times) {
i += 7;
}
if (i > times)
printf("The no result of Einstein's question \n");
else
printf("The result of Einstein's question is %d\n", i);
结果: