| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哎呀妈呀,终于调试出来了,推荐一种读入数据的写法scanf("%1d",&s[i][j]);#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator