题解 | #[NOIP2015]金币#
[NOIP2015]金币
https://www.nowcoder.com/practice/8f71f5670e6a45118d24d13868a2da9e
#include <stdio.h> int main() { int k=0,sum=0,count =0,l =1; scanf("%d",&k); for(int i =1;i<=k;i++) { if(count<l) { sum += l; count++; } if(count==l) { l++; count=0; } } printf("%d\n",sum); return 0; }