261 条题解
-
0
#include<bits/stdc++.h> using namespace std; int a[110][110],n,sum; int main() { cin>>n; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) { cin>>a[i][j]; } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { if(i==j){ sum+=a[i][j]; }else if(i+j==n+1){ sum+=a[i][j]; } } } cout<<sum; } -
0
#include<bits/stdc++.h> using namespace std; int main() { int q[100][100],a,z,w,s,x,e; cin>>a; for(int i=1;i<=a;i++) { for(int j=1;j<=a;j++) { cin>>q[i][j]; } } for(int i=1;i<=a;i++) { for(int j=1;j<=a;j++) { if(i==j) { q[i][j]=q[i][j]+10; } else if(i+j==a+1) { q[i][j]=q[i][j]+10; } } } for(int i=1;i<=a;i++) { for(int j=1;j<=a;j++) { cout<<q[i][j]<<" "; } cout<<endl; } return 0; } -
0
using namespace std; int p[100][100],o; int main() { cin>>o; for(int i=1;i<=o;i++) { for(int e=1;e<=o;e++) { cin>>p[i][e]; } } for(int i=1;i<=o;i++) { for(int e=1;e<=o;e++) { if(e==i||e+i==o+1) { p[i][e]+=10; } } } for(int i=1;i<=o;i++) { for(int e=1;e<=o-1;e++) { cout<<p[i][e]<<" "; } cout<<p[i][o]; cout<<endl; } return 0; } -
0
using namespace std; // 判断 a 是否赢 b bool win(int a, int b) { if( (a == 0 && b == 2) || (a == 2 && b == 5) || (a == 5 && b == 0)) return true; else return false; } int mo(int a, int b,int c) { if(a%b!=0) return a%b; else return c; } int main() { int N, NA, NB; int A[200], B[200]; int winA = 0, winB = 0; cin >> N >> NA >> NB; for (int i = 1; i <= NA; i++) cin >> A[i]; for (int i = 1; i <= NB; i++) cin >> B[i]; for (int i = 1; i <= N; i++) { int a_move = A[mo(i,NA,NA)]; int b_move = B[mo(i,NB,NB)]; if (win(a_move, b_move)) { winA++; } else if (win(b_move, a_move)) { winB++; } } if (winA > winB) { cout << "A" <<winA-winB<< endl; } else if (winB > winA) { cout << "B" << winB-winA<<endl; } else { cout << "draw" << endl; } return 0; } -
0
#include <bits/stdc++.h> using namespace std; // 判断 a 是否赢 b bool win(int a, int b) { if( (a == 0 && b == 2) || (a == 2 && b == 5) || (a == 5 && b == 0)) return true; else return false; } int mo(int a, int b,int c) { if(a%b!=0) return a%b; else return c; } int main() { int N, NA, NB; int A[200], B[200]; int winA = 0, winB = 0; cin >> N >> NA >> NB; for (int i = 1; i <= NA; i++) cin >> A[i]; for (int i = 1; i <= NB; i++) cin >> B[i]; for (int i = 1; i <= N; i++) { int a_move = A[mo(i,NA,NA)]; int b_move = B[mo(i,NB,NB)]; if (win(a_move, b_move)) { winA++; } else if (win(b_move, a_move)) { winB++; } } if (winA > winB) { cout << "A" <<winA-winB<< endl; } else if (winB > winA) { cout << "B" << winB-winA<<endl; } else { cout << "draw" << endl; }
return 0;}
-
0
#include <bits/stdc++.h> using namespace std; long long n,m,a[50010],b[50010],ans,x,y; int main(){ cin>>n>>m; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=m;i++) cin>>b[i]; sort(a+1,a+n+1); sort(b+1,b+m+1); x=1;y=1; while(1) { if(a[x]<=b[y]) { ans+=b[y]; x++; } y++; if(x>n) { cout<<ans; return 0; } if(y>m) { cout<<-1; return 0; } } } -
0
真的 #include<bits/stdc++.h> using namespace std; int n,m,k,b[110][110],ans; char x; int main() { cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { cin>>x; b[i][j]=b[i-1][j]+b[i][j-1]-b[i-1][j-1]; if(x=='1') b[i][j]++; } for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { for(int x=i;x<=n;x++) for(int y=j;y<=m;y++) { if(b[x][y]-b[i-1][y]-b[x][j-1]+b[i-1][j-1]==(x-i+1)(y-j+1)) ans=max(ans,(x-i+1)(y-j+1)); } } cout<<ans; }
信息
- ID
- 104
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- 递交数
- 237
- 已通过
- 64
- 上传者
