Skip to content

Instantly share code, notes, and snippets.

@sahasourav17
Created August 6, 2018 11:34
Show Gist options
  • Save sahasourav17/d05e1789bb3eade3b22b07aad9a3abab to your computer and use it in GitHub Desktop.
Save sahasourav17/d05e1789bb3eade3b22b07aad9a3abab to your computer and use it in GitHub Desktop.
codeforces 546A solution
#include<stdio.h>
int main()
{
int n , k ,w;
int i ,sum = 0;
int dollar;
scanf("%d %d %d",&k,&n,&w);
for(i = 1;i <= w;i++)
{
sum = sum + i*k;
}
dollar = sum - n;
if(dollar > 0)
{
printf("%d\n",dollar);
}
else
printf("0\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment