Kiritoyyds @ 2022-03-05 21:16:36
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b=1,k,mx=0;
cin>>a;
for(int i=1;i<=a;i++){
for(k=1;k<=b;k++){
mx+=b;
}
if(k==b){
b++;//这里b的值没变
k=1;
}
}
cout<<mx;
return 0;
}
by Ew_Cors @ 2022-03-05 21:18:18
你真的认为这个程序会进入这个 if 语句嘛?
by coldy_rainy @ 2022-03-05 21:19:35
@Kiritoyyds
if没入循环。
by Kiritoyyds @ 2022-03-05 21:27:30
@Ew_Cors 谢谢,已解决
by Kiritoyyds @ 2022-03-05 21:27:52
@penhaochen 谢谢,已解决