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

哎呀妈呀,终于调试出来了,推荐一种读入数据的写法scanf("%1d",&s[i][j]);

Posted by 2004140022 at 2015-11-27 16:34:45 on Problem 2579
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<algorithm>
#define N 11
using namespace std;
int s[N][N];
int main()
{
    char a[N];
    int i,j,m,n,t;
    while(1)
    {
        scanf("%s",a);
        if(strcmp(a,"ENDOFINPUT")==0)break;
        scanf("%d%d",&m,&n);
        memset(s,0,sizeof(s));
        for(i=0;i<m;i++)
            for(j=0;j<n;j++)
            scanf("%1d",&s[i][j]);
        scanf("%s",a);
        for(i=0;i<m-1;i++)
        {
            for(j=0;j<n-1;j++)
            {
                t=(s[i][j]+s[i+1][j]+s[i][j+1]+s[i+1][j+1])/4;
                printf("%d",t);
            }
           puts("");
        }
    }
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