Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- using namespace std;
- using namespace __gnu_pbds;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef tree<int,null_type,less<>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
- #define all(v) v.begin(),v.end()
- #define rall(v) v.rbegin(),v.rend()
- #define MOD 1000000007
- #define PI 3.14159265
- #define ceil(a, b) ((a / b) + (a % b ? 1 : 0))
- #define imin INT_MIN
- #define imax INT_MAX
- #define nl '\n'
- void Start_Crushing() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- }
- //vector<int> dx = {0, 0, 1, -1, 1, 1, -1, -1}, dy = {1, -1, 0, 0, 1, -1, 1, -1};
- //vector<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};
- int s, e, cnt = 0;
- void cntWays(int curr){
- if(curr >= e){
- cnt += curr == e;
- return;
- }
- cntWays(curr + 1);
- cntWays(curr + 2);
- cntWays(curr + 3);
- }
- void solve(){
- cin >> s >> e;
- cntWays(s);
- cout << cnt;
- }
- int main(){
- // freopen("cakes.in", "r", stdin);
- Start_Crushing();
- int t = 1;
- // /*is Single Test case?*/ cin >> t;
- while (t--) {
- solve();
- if(!t) break;
- cout << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement