Skip to content

Commit e194c16

Browse files
add123 solved
1 parent 7bc541f commit e194c16

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

Solved Archive/9095_add123/add.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int count;
5+
void checkCount(int n, int sum) {
6+
if (sum == n) {
7+
count++;
8+
return;
9+
}
10+
if (sum > n)
11+
return;
12+
13+
checkCount(n, sum+1);
14+
checkCount(n, sum+2);
15+
checkCount(n, sum+3);
16+
}
17+
18+
int main() {
19+
ios_base::sync_with_stdio(false);
20+
cin.tie(nullptr);
21+
22+
int n, T;
23+
cin >> T;
24+
25+
while (T--) {
26+
cin >> n;
27+
count = 0;
28+
checkCount(n, 0);
29+
cout << count << '\n';
30+
}
31+
32+
return 0;
33+
}

Solved Archive/9095_add123/add.exe

121 KB
Binary file not shown.

0 commit comments

Comments
 (0)