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