题目链接
题解
打表题.
按要求输出就好了.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> using namespace std ; template<class T>void read(T &x){ x=0;int f=0;char ch=getchar(); while(ch<'0'||ch>'9'){f|=(ch=='-');ch=getchar();} while(ch<='9'&&ch>='0'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();} x=f?-x:x; return ; } int main() { int n,m,l; char c; read(n),read(m),scanf(" %c",&c);read(l); if(l==1){ for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) printf("%c",c); puts(""); } } else { for(int i=1;i<=n;i++){ if(i!=1&&i!=n){ printf("%c",c); for(int j=1;j<=m-2;j++) printf(" "); printf("%c",c); puts(""); } else { for(int j=1;j<=m;j++) printf("%c",c); puts(""); } } } return 0; } |
By:Wahacer
2017.11.24
23:14