MindustrySF @ 2023-07-01 13:31:27
#include<bits/stdc++.h>
using namespace std;
long long ans,chi=1,chd=1,k,goa;
int main(){
cin>>goa;
for (int k=1;k<=goa;++k){
//printf("[debug_l]chi=%d chd=%d ans=%d\n",chi,chd,ans);
ans+=chi;
if (chi==chd){
++chi;
chd=0;
}
else {//chi>chd
++chd;
}
//printf("[debug_r]chi=%d chd=%d ans=%d k=%d\n\n",chi,chd,ans,k);
}
cout<<ans;
return 0;
}
ans是答案,k变成了天数 goa是题目中的k
by rnf5114 @ 2023-07-01 13:46:09
@xhr0666 chd=1
by rnf5114 @ 2023-07-01 13:46:24
怎么可能有0天呢