KobeBeanBryant @ 2021-01-19 20:33:49
#include<bits/stdc++.h>
using namespace std;
int a,i=1,j=0,l;
long long k;
int main(){
cin>>a;
while(l<a){
k+=i;
j++;
l++;
if(j==i){
j=1;
i++;
continue;
}
}
cout<<k;
}
第三个点AC其他WA,求助
by _脑波_ @ 2021-01-19 20:35:29
很简单
by w23c3c3 @ 2021-01-19 20:36:18
j=1;
->j=0;
就行了
by KobeBeanBryant @ 2021-01-19 20:37:30
在哪里加
by IANY_H @ 2021-01-19 21:01:51
@KobeBeanBryant 看到名字莫名想哭
by IANY_H @ 2021-01-19 21:04:24
#include<bits/stdc++.h>
using namespace std;
int a,i=1,j=0,l;
long long k;
int main(){
cin>>a;
while(l<a){
k+=i;
j++;
l++;
if(j==i){
j=0;
i++;
continue;
}
}
cout<<k;
}
by IANY_H @ 2021-01-19 21:04:55
@KobeBeanBryant
using namespace std;
int a,i=1,j=0,l;
long long k;
int main(){
cin>>a;
while(l<a){
k+=i;
j++;
l++;
if(j==i){
j=0;
i++;
continue;
}
}
cout<<k;
}