【CodeForces】[546A]Soldier and Bananas
直接运算
并没有什么弯
注意int就足以储存数据
不需要借钱时(n>res)
输出 0
#include<stdio.h>
int main() {
int k,n,w;
while(scanf("%d %d %d",&k,&n,&w)!=EOF) {
int res=0;
for(int i=1; i<=w; i++)
res+=i*k;
if(n>res)
printf("0\n");
else
printf("%d\n",res-n);
}
return 0;
}