| ||||||||||
| 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 | |||||||||
Why WA??? Help me, The ACer! Here is my code. Thank you!!#include<iostream.h>
#include<string>
#include<stdio.h>
//xxxlxr 2579 Wrong Answer C++ 0.81K 2005-08-27 02:37:54.0
char s[15];
char map[9][9];
int m2[9][9];
int r, c;
char ch;
//xxxlxr 2579 Wrong Answer G++ 1.04K 2005-08-27 03:08:37.0
main()
{
int i, j;
//while(gets(s))
while(1)
{
i=0;
while((ch=getchar()) && ch!='\n' && ch!=' ') s[i++]=ch;
s[i]='\0';
if(s[0]=='\0') break;
if(strcmp("ENDOFINPUT", s)==0) break;
scanf(" %d %d", &r, &c);
getchar();
//r=s[6]-'0';
//c=s[8]-'0';
for(i=0; i<r; i++)
for(j=0; j<c; j++)
{
cin>>map[i][j];
}
for(i=0; i<r-1; i++)
{
for(j=0; j<c-1; j++)
{
m2[i][j]=((int)(map[i][j]-'0')+(int)(map[i][j+1]-'0')+(int)(map[i+1][j]-'0')+(int)(map[i+1][j+1]-'0'))/4;
cout<<m2[i][j];
}
cout<<endl;
}
//getchar();
gets(s);
if(s[0]=='\0') break;
if(strcmp("END", s)==0) continue;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator