public static void main(String[] args) {
int largestChain = 0;
for(int i = 1; i < 1000000; ++i) {
if(chain(i) > largestChain) {
largestChain = chain(i); // Here, how do I print the final value
// of 'i' that respects the rule chain(i)?
}
}
System.out.print(largestChain);
}
例如,如果i = 13
, chain(i) = 10
,并且largestChain
13(从 1 开始)是 10。现在假设我们有一个循环,从 1 到 100,并且largestChain
仍然是 10,相同的i = 13
。i
当循环必须完成其任务(并进入 100)时,我该如何打印?