Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_DEPRECATE
- #define _SECURE_SCL 0
- #pragma comment(linker, "/STACK:200000000")
- #include <algorithm>
- #include <bitset>
- #include <cassert>
- #include <cctype>
- #include <complex>
- #include <ctime>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <deque>
- #include <functional>
- #include <fstream>
- #include <iostream>
- #include <map>
- #include <memory.h>
- #include <numeric>
- #include <queue>
- #include <set>
- #include <stack>
- #include <string>
- #include <sstream>
- #include <vector>
- #include <utility>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- #define pb push_back
- #define mp make_pair
- #define mset(mas,val) memset(mas,val,sizeof(mas))
- #define sz(a) (int)(a).size()
- #define all(a) (a).begin(), (a).end()
- #define rall(a) (a).rbegin(), (a).rend()
- #define forn(i,n) for (int i=0; i<int(n); ++i)
- #define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
- #define forab(i,a,b) for (int i=int(a); i<=int(b); ++i)
- typedef long long ll;
- typedef long double ld;
- typedef unsigned long long ull;
- const int INF = (int) 1e9;
- const long long INF64 = (long long) 1e18;
- const long double eps = 1e-9;
- const long double pi = 3.14159265358979323846;
- const int MK = 1000;
- const int MN = 29;
- long long dp[MN + 2][MK + 100];
- long long d[MK + 100];
- int modulo = 7340033;
- void process() {
- for(int i=0; i<=MN; i++) {
- dp[i][0] = 1;
- for(int j=0; j<=MK; j++)
- for(int k=0; k<=MK-j; k++)
- d[j+k]+=dp[i][j]*dp[i][k];
- for(int j=0; j<=MK; j++)
- d[j] %= modulo;
- for(int j=0; j<=MK; j++)
- for(int k=0; k<=MK-j; k++)
- dp[i+1][j+k+1]+=d[j]*d[k];
- for(int j=0; j<=MK; j++)
- dp[i+1][j] %= modulo;
- mset(d, 0);
- }
- }
- int main(){
- #ifndef ONLINE_JUDGE
- freopen("input.txt","rt",stdin);
- freopen("output.txt","wt",stdout);
- #endif
- int Q;
- scanf("%d", &Q);
- process();
- while (Q--) {
- long long n, k;
- scanf("%I64d %d", &n, &k);
- int iter = 0;
- while (n > 1 && n % 2 == 1)
- iter++, n/=2;
- printf("%d\n", dp[iter][k]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement