PROGRAMMING PROBLEMS & SOLUTIONS
Pages
HOME
URI
UVA
CODEFORCES
HACKERRANK
EXTRA
CONTACT
Tuesday, May 31, 2016
CODEFORCES problem 546A Soldier and Bananas
Problem link (
Click here
)
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int k,n,w;
int rate;
int cost=0;
int loan;
cin>> k >> n >> w;
for(int i=1; i<=w; i++){
rate=i*k;
cost=cost+rate;
}
loan=cost-n;
if(loan<0)
loan=0;
cout<<loan<<endl;
return 0;
}
1 comment:
Lack O' Blanco
January 14, 2017 at 1:29 AM
Thank you, good program i needed it keep up the good work ;)
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Thank you, good program i needed it keep up the good work ;)
ReplyDelete