Codeforces-SolutionsA/Codes/546 A - Soldier and Bananas/546A.cpp

15 lines
232 B
C++
Raw Normal View History

2023-06-08 00:31:31 +08:00
#include<bits/stdc++.h>
using namespace std;
int main()
{
int k,n,w;
cin>>k>>n>>w;
int i,money=0;
for(i=1;i<=w;i++)
{
money=money+i*k;
}
if(money>n) cout<<money-n<<endl;
else cout<<0<<endl;
}