-
Notifications
You must be signed in to change notification settings - Fork 28
/
ap2.cpp
47 lines (38 loc) · 960 Bytes
/
ap2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define inf 1000000000
#define MAXN 100000
using namespace std;
int main() {
int t;
scanf("%d", &t);
for (int qwertz = 0; qwertz < t; ++qwertz) {
long long term3, lastTerm3, sum;
scanf("%lld%lld%lld", &term3, &lastTerm3, &sum);
long long n;
if ((term3+lastTerm3) & 1) n = 2*sum/(term3+lastTerm3);
else n = sum/((term3+lastTerm3)/2);
long long d = (sum - n*term3)/((n-3)*(n-2)/2 -3);
long long a = term3 - 2*d;
printf("%lld\n", n);
for (int i = 0; i < n; ++i) {
printf("%lld ", a);
a += d;
}
}
return 0;
}