Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贴代码

Posted by 130428199210122910 at 2012-08-31 18:06:51 on Problem 2579
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    int i,j,r,c,ans[10][10];
    char a[20],map[10][10];
    while(1)
    {
        cin>>a>>r>>c;
        if(strcmp(a,"ENDOFINPUT")==0)
        {
            break;
        }
        for(i=0;i<r;i++)
        {
           cin>>map[i];
        }
        cin>>a;
        for(i=0;i<r-1;i++)
        {
            for(j=0;j<c-1;j++)
            {
                ans[i][j]=(map[i][j]-'0'+map[i+1][j]-'0'+map[i+1][j+1]-'0'+map[i][j+1]-'0')/4;
                cout<<ans[i][j];
            }
            cout<<endl;
        }
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator