Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93506 胡海峰老师 15加到第几项 C Accepted 0 MS 192 KB 254 2024-10-17 14:20:02

Tests(1/1):


Code:

#include <stdio.h> int main() { int s=0; int i=1; while(1) { s = s+i; if(s>1000) break; i +=1; } printf("%d",i); return 0; } /* 1+2+……+45 tot = (1+45)*45/2 = 23*45 = 1035 1035-45= 990 1+2+……+44 */