Untitled
unknown
c_cpp
a year ago
358 B
7
Indexable
#include <iostream>
using namespace std;
int countWays(int S, int E) {
if (S == E) {
return 1;
}
if (S > E) {
return 0;
}
return countWays(S + 1, E) + countWays(S + 2, E) + countWays(S + 3, E);
}
int main() {
int S, E;
cin >> S >> E;
cout << countWays(S, E) << endl;
return 0;
}
Editor is loading...
Leave a Comment