fork(1) download
  1. #include <bits/stdc++.h>
  2. // 12345678901234567890
  3. #define MAX 1000000008
  4. #define FAST ios_base::sync_with_stdio(0)
  5. using namespace std;
  6.  
  7. int main(){
  8. FAST;
  9. int t;
  10. cin >> t;
  11. while(t--){
  12. int piles , starting , pilenow, diff , total;
  13. cin >> piles >> starting >> diff;
  14. total = starting;
  15. pilenow = starting;
  16. for (int i = 1; i < piles; ++i)
  17. {
  18. pilenow = pilenow + diff;
  19. total += pilenow;
  20. }
  21. cout << total << '\n';
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 3456KB
stdin
3
1 1 1
3 5 6
2 1 2
stdout
1
33
4