We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7bc541f commit e194c16Copy full SHA for e194c16
Solved Archive/9095_add123/add.cpp
@@ -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
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
0 commit comments