7 条题解
-
3
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c;char n; cin>>a>>b>>n>>c; if (c) { for (int i=1;i<=a;i++) { for (int j=1;j<=b;j++) cout<<n; cout<<endl; } } else { for (int i=1;i<=b;i++) { cout<<n; } cout<<endl; for (int i=1;i<=a-2;i++) { cout<<n; for (int j=1;j<=b-2;j++) { cout<<' '; } cout<<n<<endl; } for (int i=1;i<=b;i++) { cout<<n; } cout<<endl; } return 0; }
为什么我写得那么长啊···
-
2
`
#include<bits/stdc++.h> using namespace std; void One(int b,int a,char s){ for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ cout<<s; } cout<<endl; } } void Zero(int b,int a,char s){ for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ if(i==1 || i==a || j==1 || j==b) cout<<s; else cout<<" "; } cout<<endl; } } int main(){ int a,b,n; char s; cin>>a>>b>>s>>n; if(n==0) Zero(b,a,s); else if(n==1) One(b,a,s); return 0; }
-
1
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,d; char c; cin>>a>>b>>c>>d; if (d==1) { for (int i=1;i<=a;i++) { for (int j=1;j<=b;j++) { cout<<c; } cout<<endl; } } else { for (int i=1;i<=a;i++) { for (int j=1;j<=b;j++) { if (i==1 || j==1 ) { cout<<c; } else if(i==a || j==b) { cout<<c; } else { cout<<" "; } } cout<<endl; } } return 0; } 呵呵,就说有一亿点长好吧🤭 ```点个赞呗!
-
1
#include<iostream> #include<iomanip> using namespace std; int main(){ int n,m; char a; bool b; cin>>n>>m>>a>>b; for(int i =1;i<=n;i++){ for(int j = 1;j<=m;j++){ if(i == 1||i == n){ cout<<a; } else{ if(b){ cout<<a; } else if(j==1||j==m){ cout<<a; } else{ cout<<" "; } } } cout<<"\n"; } }
-
0
#include <bits/stdc++.h> using namespace std; int main() { int a,b; char c; int d; cin >> a >> b >> c >> d; if(d == 1) { for(int i = 1;i<=a;i++) { for(int j = 1;j<=b;j++) { cout << c; } cout << endl; } } else if(d == 0) { for(int i = 1;i<=a;i++) { for (int j = 1;j<=b;j++) { if(i == 1||i ==a||j ==1||j==b) cout << c; else cout << " "; } cout << endl; } } return 0; }
-
-1
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c;char n; cin>>a>>b>>n>>c; if (c) { for (int i=1;i<=a;i++) { for (int j=1;j<=b;j++) cout<<n; cout<<endl; } } else { for (int i=1;i<=b;i++) { cout<<n; } cout<<endl; for (int i=1;i<=a-2;i++) { cout<<n; for (int j=1;j<=b-2;j++) { cout<<' '; } cout<<n<<endl; } for (int i=1;i<=b;i++) { cout<<n; } cout<<endl; } return 0; }
更适合中国宝宝体制的代码
- 1
信息
- ID
- 189
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 2
- 标签
- 递交数
- 131
- 已通过
- 81
- 上传者