Unaccepted_Error @ 2022-10-08 16:43:19
#include <bits/stdc++.h>
using namespace std;
int main(){
int k,n = 1,m = 0;
cin >> k;
for(int i = 1;i <= k;i ++)
k -= i,m += n * n,n ++;
cout << m + k * n;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
int k,n = 1,m = 0;
cin >> k;
for(int i = 1;i <= k;i ++)
k -= i;
m += n * n;
n ++;
cout << m + k * n;
return 0;
}
by 鏡音リン @ 2022-10-08 16:44:45
您需要大括号
by WaltVBAlston @ 2022-10-08 16:45:06
@mengwangjianning 你如果要换行的话for循环就要用括号把你想在括号内执行的语句括起来,否则默认只循环for下面第一行的内容。
,的作用是允许你在同一行执行多个语句
by WaltVBAlston @ 2022-10-08 16:45:22
@鏡音リン rin楼下
by kets4eki @ 2022-10-08 16:46:06
大括号是个好东西
by itisover @ 2022-10-08 16:46:11
@WaltVBAlston WaltVBAlston 楼下
by WaltVBAlston @ 2022-10-08 16:46:48
@S11EDG S11EDG楼下
by 鏡音リン @ 2022-10-08 16:47:31
@WaltVBAlston WaltVBAlston楼下
by itisover @ 2022-10-08 16:48:25
@lyqqqqq 紫杉!!!!
by a2lyaXNhbWUgbWFyaXNh @ 2022-10-08 16:49:15
楼nm下
by Unaccepted_Error @ 2022-10-08 16:52:12
楼下()