zoukankan      html  css  js  c++  java
  • hdu 2052 picture

    Problem Description
    Give you the width and height of the rectangle,darw it.
     
    Input
    Input contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the rectangle.Iuput ends of EOF.
     
    Output
    For each case,you should draw a rectangle with the width and height giving in the input.
    after each case, you should a blank line.
     
    Sample Input
    3 2
     
    Sample Output
    +---+
    |     |
    |     |
    +---+
    一开始没注意到多组输入之间有空白行。。。一直PE
    AC Code:
     1 #include<iostream>
     2 #include<iomanip>
     3 #include<cstdio>
     4 #include<cstdlib>
     5 #include<cstring>
     6 #include<cmath>
     7 #include<string>
     8 #include<algorithm>
     9 #include<vector>
    10 #include<map>
    11 #include<stack>
    12 #include<queue>
    13 #include<deque>
    14 #include<set>
    15 #include<cctype>
    16 #define LL long long
    17 #define maxn (int)1e5
    18 #define INF 0x3f3f3f3f
    19 using namespace std;
    20 int main()
    21 {
    22     ios::sync_with_stdio(false);
    23     cin.tie(0);
    24     cout.tie(0);
    25     #ifndef ONLINE_JUDGE
    26     freopen("input.txt","r",stdin);
    27     #endif
    28     int T;
    29     int n,m;
    30     while(cin>>n>>m)
    31     {
    32       for(int i=1;i<=m+2;++i)
    33       {
    34         for(int j=1;j<=n+2;++j)
    35         {
    36           if((i==1||i==m+2)&&(j==1||j==n+2)) cout<<'+';
    37           else if(i==1||i==m+2) cout<<'-';
    38           else if(j==1||j==n+2) {cout<<'|';}
    39           else cout<<" ";
    40         }
    41          cout<<endl;
    42       }
    43     }
    44 
    45 
    46 }
    View Code
     
  • 相关阅读:
    Java线程九:线程的调度-让步
    Java线程八:线程的调度-优先级
    Java线程七:线程的调度-休眠
    Java线程六:线程的交互
    丸の内の霊 5
    丸の内の霊 4
    丸の内の例 3
    丸の内の例 2
    幽霊物件 1
    質問力 D
  • 原文地址:https://www.cnblogs.com/Auroras/p/11188091.html
Copyright © 2011-2022 走看看