Run ID:116973
提交时间:2025-04-13 09:22:25
#include<iostream> using namespace std; int main(){ /** for(int i = 1;i<= 100;i++){ if(i == 50){ break;//结束 之后所有都结束 //continue;//只结束满足条件 } cout<<i; } **/ // 1 - n s = 1+ 2+3 +..+n 刚好s>1000 时 求n int s = 0; int n=0; while(s<= 1000){ n++; s +=n; } cout<<n; return 0; }