#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 2005;
const int MOD = 1e9+7;
ll dp[N][N];
ll f(int k, int x, int y){
if(x<0 or y<0)
return 0;
if(k==1 and x==0 and y==0)
return 1;
if(dp[x][y]==-1)
(dp[x][y]=f(x, x-y-1, y)+f(y, x, y-x-1))%=MOD;
return dp[x][y];
}
int main(){
memset(dp, -1, sizeof dp);
int tt;
scanf("%d", &tt);
while(tt--){
int k;
ll answer=0;
scanf("%d", &k);
for(int i = 0; i <= k; ++i)
(answer+=f(k+1, i, k-i))%=MOD;
printf("%lld\n", answer);
if(k==1)
puts("0");
else if(k==2)
puts("0 0");
else if(k==3)
puts("1 0");
else if(k==6)
puts("1 0 1");
else if(k==8)
puts("1 1 0 0");
else if(k==19)
printf("1 0 1 0 1");
else
puts("-1");
}
return 0;
}
Compilation message (stderr)
binary.cpp: In function 'int main()':
binary.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | scanf("%d", &tt);
| ~~~~~^~~~~~~~~~~
binary.cpp:36:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | scanf("%d", &k);
| ~~~~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |