T1
| |
| |
| |
| |
| #include<bits/stdc++.h> |
| using namespace std; |
| |
| int n; |
| string x; |
| |
| int main(){ |
| cin>>n; |
| while(n--){ |
| cin>>x; |
| if(x[x.size()-1]=='0'||x[x.size()-1]=='2'||x[x.size()-1]=='4'||x[x.size()-1]=='6'||x[x.size()-1]=='8') cout<<"even\n"; |
| else cout<<"odd\n"; |
| } |
| return 0; |
| } |
T2
| |
| |
| |
| |
| |
| |
| #include<bits/stdc++.h> |
| using namespace std; |
| int n; |
| int main(){ |
| cin>>n; |
| if(n%2==1) cout<<7,n-=3; |
| while(n) cout<<1,n-=2; |
| return 0; |
| } |
T3
| |
| |
| |
| |
| |
| |
| |
| |
| #include<bits/stdc++.h> |
| using namespace std; |
| |
| int T,a[3]; |
| |
| int main(){ |
| cin>>T; |
| while(T--){ |
| int t=0; |
| for(int i=0;i<3;i++) |
| cin>>a[i],t+=(!a[i]); |
| sort(a,a+3); |
| if(t==2) cout<<"0\n"; |
| else if(t==1&&a[1]==a[2]) cout<<"1\n"; |
| else if(t==1||a[1]==a[2]||a[0]+a[1]==a[2]||a[0]==a[1]) cout<<"2\n"; |
| else cout<<"3\n"; |
| } |
| return 0; |
| } |
T4
| |
| |
| |
| |
| |
| #include<bits/stdc++.h> |
| using namespace std; |
| |
| int T,n,k; |
| char a[31][31],b[31][31],c[31][31],t[31][31]; |
| |
| void rotate(){ |
| for(int i=1;i<=k;i++) |
| for(int j=1;j<=k;j++) |
| t[i][j]=b[k-j+1][i]; |
| for(int i=1;i<=k;i++) |
| for(int j=1;j<=k;j++) |
| b[i][j]=t[i][j]; |
| } |
| bool check(){ |
| for(int i=1;i<=n;i++) |
| for(int j=1;j<=n;j++) |
| if(a[i][j]=='*'&&c[i][j]!='*') |
| return 0; |
| return 1; |
| } |
| void paint(int x,int y){ |
| for(int i=1;i<=k;i++) |
| for(int j=1;j<=k;j++) |
| if(a[x+i-1][y+j-1]=='.'&&b[i][j]=='*') |
| return; |
| |
| for(int i=1;i<=k;i++) |
| for(int j=1;j<=k;j++) |
| if(b[i][j]=='*') |
| c[x+i-1][y+j-1]=b[i][j]; |
| } |
| |
| string work(){ |
| cin>>n; |
| for(int i=1;i<=n;i++) |
| for(int j=1;j<=n;j++) |
| cin>>a[i][j],c[i][j]='.'; |
| cin>>k; |
| for(int i=1;i<=k;i++) |
| for(int j=1;j<=k;j++) |
| cin>>b[i][j]; |
| |
| for(int i=1;i<=4;i++){ |
| rotate(); |
| for(int i=1;i+k-1<=n;i++) |
| for(int j=1;j+k-1<=n;j++) |
| paint(i,j); |
| } |
| |
| return check()?"YES":"NO"; |
| } |
| |
| int main(){ |
| cin>>T; |
| while(T--) cout<<work()<<'\n'; |
| return 0; |
| } |
T5
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #include<bits/stdc++.h> |
| using namespace std; |
| |
| int n; |
| bool ans[31],vis[31]; |
| char a[31][31]; |
| string s[31]; |
| |
| void update(string x){ |
| for(int i=1;i<=n;i++) |
| if(x==s[i]) ans[i]=1; |
| } |
| |
| void dfs(int x,string ss){ |
| update(ss); |
| if(x==5) return; |
| for(int i=1;i<=4;i++){ |
| if(!vis[i]){ |
| for(int j=1;j<=6;j++){ |
| vis[i]=1; |
| dfs(x+1,ss+a[i][j]); |
| vis[i]=0; |
| } |
| } |
| } |
| } |
| |
| int main(){ |
| cin>>n; |
| for(int i=1;i<=4;i++) |
| for(int j=1;j<=6;j++) |
| cin>>a[i][j]; |
| for(int i=1;i<=n;i++) cin>>s[i]; |
| dfs(1,""); |
| for(int i=1;i<=n;i++){ |
| if(ans[i]) cout<<"YES\n"; |
| else cout<<"NO\n"; |
| } |
| return 0; |
| } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了