https://vjudge.net/contest/313217
喔要补完题!!
A
#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; #define ll long long const int maxn=1e6+10; ll f[maxn][2]; int main() { freopen("azerah.in","r",stdin); freopen("azerah.out","w",stdout); int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); for(int i=1; i<=n; i++) { int a; scanf("%d",&a); f[i][0]=f[i][1]=0; if(a%2==0) { f[i][0]=(f[i-1][0]*2)%mod; f[i][1]=(f[i-1][1]*2)%mod; f[i][0]=(f[i][0]+1)%mod; } else { f[i][0]=(f[i-1][0]+f[i-1][1])%mod; f[i][1]=(f[i-1][1]+f[i-1][0])%mod; f[i][1]=(f[i][1]+1)%mod; } // printf("%d %d ",f[i][0],f[i][1]); } printf("%lld ",f[n][0]%mod); } return 0; }
B
C
D
E
F
G
H
I
#include<bits/stdc++.h> using namespace std; //const int maxn=1e7+10; #define ll long long //map<ll,ll> m; ll fun(ll n) { ll ans=0; int i; for(i=1; i<=(int)sqrt(n); i++) ans=ans+n/i; i--; ans=ans*2; ans=ans-i*i; return ans; } int main() { freopen("perechi3.in","r",stdin); freopen("perechi3.out","w",stdout); int t; scanf("%d",&t); while(t--) { ll n; scanf("%lld",&n); ll ans=fun(n); printf("%lld ",ans); } }
J
K
L
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { freopen("semipal.in","r",stdin); freopen("semipal.out","w",stdout); int t; scanf("%d",&t); while(t--) { int n; ll k; string s; scanf("%d%lld",&n,&k); k--; for(int i=n-1;i>=1;i--) { if((k>>(i-1))&1) s+='b'; else s+='a'; } s+=s[0]; cout<<s<<endl; } }