L1-054 福到了
题目 L1-054 福到了
思路分析
代码实现
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
using ll = long long;
using ull = unsigned long long;
using PII = pair<int,int>;
using Pll = pair<ll,ll>;
int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
const int inf = 0x3f3f3f3f;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
char c;int n;cin>>c>>n;
cin.ignore();
vector<vector<char>> g(n);
for(int i=0;i<n;i++){
string s; getline(cin,s);
for(int j=0;j<n;j++){
g[i].push_back(s[j]);
}
}
bool buyongdao=true;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
// if(g[i][j]==' ') cout<<g[i][j];
// else if(g[i][j]=='@') cout<<c;
if(g[i][j]!=g[n-i-1][n-j-1]){
buyongdao=false;
}
}
}
if(buyongdao){
cout<<"bu yong dao le"<<endl;
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(g[n-i-1][n-j-1]=='@') cout<<c;
else cout<<g[n-i-1][n-j-1];
}
cout<<endl;
}
return 0;
}
同类题型
视频讲解
⬅️ L1-053 电子汪 🏠 00-天梯赛 ➡️ L1-055 谁是赢家
💬 评论