九进制转十进制
#includeusing namespace std; int main() { cout<<1478< 顺子日期
#includeusing namespace std; typedef long long ll; int months[]={0,31,28,31,30,31,30, 31,31,30,31,30,31}; int main() { ios::sync_with_stdio(false); cin.tie(0); int year=2022,month=1,day=1; int ans=0; for(int i=1;i<=365;i++) { char ch[9]={0}; sprintf(ch,"%04d%02d%02d",year,month,day); bool flag=false; for(int j=0;j<6;j++) { if(ch[j+1]==ch[j]+1&&ch[j+2]==ch[j]+2) { flag=true; break; //ans++;不能这样,可能会多算 } } if(flag==true) ans++; day++; if(day>months[month]) { day=1; month++; } } cout< 刷题统计
#includeusing namespace std; typedef long long LL; int main() { ios::sync_with_stdio(false); cin.tie(0); LL n; LL a,b; cin>>a>>b>>n; LL w =5*a+2*b; LL week_count=n/w; LL yu_n = n%w; LL day_c=0; if(yu_n==0) { cout< if(i==6||i==7) yu_n-=b; else yu_n-=a; day_c++; if(yu_n<=0) break; } cout< 修剪灌木
#includeusing namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; for(int i=1;i<=n;i++) { if(i<=n/2) { cout<<2*(n-i)< cout<<2*(i-1)< X进制减法
#includeusing namespace std; int jin_zhi[100000],A[100000],B[100000]; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin>>N; int Ma,Mb; cin>>Ma; for(int i=Ma-1;i>=0;i--) cin>>A[i]; cin>>Mb; for(int i=Mb-1;i>=0;i--) cin>>B[i]; int W=max(Ma,Mb);//W表示最多几位 bool exist_N=false; for(int i=0;i jin_zhi[i]=max(A[i],B[i])+1; if(jin_zhi[i]<2) jin_zhi[i]=2; if(jin_zhi[i]==N) exist_N=true; } if(exist_N==false) jin_zhi[W-1]=N; long long s=1,result=0; for(int i=0;i result=(result+(A[i]-B[i])*s)%1000000007; s=(s*jin_zhi[i])%1000000007;//s也要取余,哭了 } cout< 统计子矩阵
#includeusing namespace std; typedef long long ll; const int N=510; int n,m,k; int s[N][N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>m>>k; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { cin>>s[i][j]; s[i][j]+=s[i-1][j]; } ll res=0; for(int i=1;i<=n;i++) for(int j=i;j<=n;j++) for(int l=1,r=1,sum=0;r<=m;r++) { sum+=s[j][r]-s[i-1][r]; while(sum>k) { sum-=s[j][l]-s[i-1][l]; l=l+1; } res +=r-l+1; } cout< 积木画
#includeusing namespace std; const int N=1e7+10,MOD=1e9+7; int n; int g[4][4]={ {1,1,1,1}, {0,0,1,1}, {0,1,0,1}, {1,0,0,0}, }; //f[i][j]表示已经操作完前i-1列且第i列的状态为0的所有方案的集合 int f[2][4]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n; f[1][0]=1; for(int i=1;i<=n;i++) { memset(f[i+1&1],0,sizeof(f[0])); for(int j=0;j<4;j++) for(int k=0;k<4;k++) if(g[j][k]) f[i+1 & 1][k]=(f[i+1 & 1][k]+f[i & 1][j])%MOD; } cout< 扫雷
#includeusing namespace std; typedef long long LL; const int N=50010,M = 999997; int n,m; struct Circle { int x,y,r; }cir[N]; LL h[M];//哈希表 int id[M];// bool st[M];//雷是否爆 //将x,y转成long long LL get_key(int x,int y)//根据坐标求哈希值 { return x*1000000001ll+y;//整数后加ll会把整数转longlong } //将long long转成999997以内 int find(int x,int y) { LL key=get_key(x,y); int t = (key % M+M)%M;//转成非负,下标 while(h[t]!=-1&&h[t]!=key) if(++t==M) t=0; return t; } int sqr(int x) { return x*x; } void dfs(int x,int y,int r) { st[find(x,y)]=true; for(int i=x-r;i<=x+r;i++) for(int j=y-r;j<=y+r;j++) if(sqr(i-x)+sqr(j-y)<=sqr(r)) { int t=find(i,j); if(id[t]&&!st[t])//如果有雷并且这个雷被搜过 { dfs(i,j,cir[id[t]].r); } } } int main() { ios::sync_with_stdio(false); cin.tie(0); memset(h,-1,sizeof(h)); cin>>n>>m; for(int i=1;i<=n;i++) { //cin>>cir[i].x>>cir[i].y>>cir[i].r; int x,y,r; cin>>x>>y>>r; cir[i]={x,y,r}; int t=find(x,y);//求哈希值 if(h[t]==-1) h[t]=get_key(x,y); if(!id[t]||cir[id[t]].r int x,y,r; cin>>x>>y>>r; //枚举火箭周围的所有点 for(int i=x-r;i<=x+r;i++) for(int j=y-r;j<=y+r;j++) { if(sqr(i-x)+sqr(j-y)<=sqr(r)) { int t=find(i,j); if(id[t]&&!st[t])//如果点存在且这个点未被搜过,则搜这个点 dfs(i,j,cir[id[t]].r); } } } int res=0; for(int i=1;i<=n;i++) if(st[find(cir[i].x,cir[i].y)]) res++; cout< 李白打酒加强版
#includeusing namespace std; const int N=103,M=103,MOD=1000000007; int f[N][M][M]; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin>>t; pair p[t]; for(int i=0;i int x,y; cin>>x>>y; p[i]={x,y}; } for(int tt=0;tt int n,m; n=p[tt].first; m=p[tt].second; memset(f,0,sizeof(f)); f[0][0][2]=1; for(int i=0;i<=n;i++) for(int j=0;j<=m;j++) for(int k=0;k<=m;k++) { if(k%2==0&&i>=1) f[i][j][k]=(f[i][j][k]+f[i-1][j][k/2])%MOD; if(j>=1) f[i][j][k]=(f[i][j][k]+f[i][j-1][k+1])%MOD; } cout< 砍竹子
#includeusing namespace std; typedef long long LL; const int N=200009,M=7; int n,layer; LL f[N][M]; int main() { cin>>n; int ans=0; for(int i=0;i LL temp[7]; int top=0; LL h; cin>>h; while(h>1) temp[top++]=h,h=sqrt(h/2+1); layer=max(top,layer); ans+=top; for(int j=0;top>0;top--,j++) { f[i][j]=temp[top-1]; } } for(int i=0;i if((f[j][i]==f[j-1][i])&&f[j][i]) ans--; } cout<



