fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. double a,i,n,t = 0; cin >> a >> i >> n;
  6. t = (n/2.0)*(2.0*a + (n-1.0)*a);
  7. cout << fixed << (int)max(t-i,0.0);
  8. return 0;
  9. }
Success #stdin #stdout 0.01s 5284KB
stdin
1000 0 1000
stdout
500500000