不知道你会不会Markdown
by ___I_AK_IOI @ 2018-09-24 21:45:08
不会 = = (如果能解释一下,如果我能理解的话= =也行的)
by Slash @ 2018-09-24 21:46:51
```cpp
#include <cstdio>
using namespace std;
int main() {
int K=0,coin=0,g=0;
scanf("%d",&K);
for(int n=1,t=1; n<=K; n+=n++,t++) {
coin+=tt;
if(n+=n++>K) {
g=K-n;
coin+=g(t++);
}
}
printf("%d",coin);
return 0;
}
```
by haohaoh4 @ 2018-09-24 21:49:11
dev-c++自带的格式化,你值得拥有。还有Markdown了解一下
by haohaoh4 @ 2018-09-24 21:50:00
希望更丰富的展现?[使用Markdown](https://www.luogu.org/wiki/show?name=%E5%B8%AE%E5%8A%A9%EF%BC%9Amarkdown)
附上我的AC代码:
```cpp
#include<iostream>
using namespace std;
typedef unsigned long long ull;
ull a;
int k;
int main(){
cin>>k;
int i=1;
while(k!=0){
if(i>k){
a+=k*i;
break;
}
else{
a+=i*i;
k-=i;
i++;
}
}
cout<<a;
return 0;
}
```
by 冬瓜皮 @ 2018-09-24 21:50:49
@[冬瓜皮](/space/show?uid=92287) ~~typedef只是为了证明自己会这个骚东西了~~
by 冬瓜皮 @ 2018-09-24 21:52:53
@[冬瓜皮](/space/show?uid=92287) ~~明明用define也可以~~
```cpp
#define ull unsigned long long
```
by 森岛_帆高 @ 2018-09-24 21:58:44
@[handahao](/space/show?uid=37617) = =谢谢 了解一下 恩我想可能是因为如果是刚好的时候会再重复一次的原因可还是不行):
#include <cstdio>
using namespace std;
int main()
{
int K,coin=0,g=0,n=1,t=1;
scanf("%d",&K);
for(;n<K;n+=n++,t++)
{
coin+=t*t;
}
if(n>=K)
{
g=n-K;
coin-=g*(t++);
}
printf("%d",coin);
return 0;
}
by Slash @ 2018-09-24 22:04:28
@[lhaoyuan_renjie](/space/show?uid=117926) %%%%%%%%%%
by 冬瓜皮 @ 2018-09-24 22:19:51
@[冬瓜皮](/space/show?uid=92287) %%%%%%%%%%%%%%%%%%
by 森岛_帆高 @ 2018-09-24 22:21:48