fork download
  1. #include <cstdio>
  2.  
  3. int main(){
  4. int n, m;
  5. int x = 0, y = 0, d;
  6.  
  7. scanf("%d%d%d", &n, &m, &d);
  8.  
  9. for (int i=1; i<=n; i++) x += d;
  10. for (int i=1; i<=m; i++) y += d;
  11.  
  12. printf("%d\n", x - y);
  13. return 0;
  14. }
Success #stdin #stdout 0s 3472KB
stdin
500 499 1000000000
stdout
1000000000