附赠代码
#include<bits/stdc++.h> using namespace std; int main () { int a_first, a_second, num; cin >> a_first >> a_second >> num; cout << a_first * num + num * (num - 1) * (a_second - a_first) / 2; return 0; }