Skip to content

Commit de3fbca

Browse files
authored
Create 1790B. Taisia and Dice.cpp
1 parent 519d4ca commit de3fbca

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int t, n, s, r;
6+
7+
int main() {
8+
#ifndef ONLINE_JUDGE
9+
freopen("input.in", "r", stdin);
10+
#endif
11+
12+
scanf("%d", &t);
13+
14+
while(t-- != 0) {
15+
scanf("%d %d %d", &n, &s, &r);
16+
17+
vector<int> dices;
18+
dices.resize(n);
19+
dices[0] = s - r;
20+
21+
while(r > 0) {
22+
for(int i = 1; r > 0 && i < dices.size(); ++i) {
23+
++dices[i];
24+
--r;
25+
}
26+
}
27+
28+
for(int i = 0; i < dices.size(); ++i) {
29+
printf("%d ", dices[i]);
30+
}
31+
puts("");
32+
}
33+
34+
return 0;
35+
}

0 commit comments

Comments
 (0)