| ||||||||||
| 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 | |||||||||
Re:为什么是wa 有高人能指点一下吗In Reply To:为什么是wa 有高人能指点一下吗 Posted by:00448322 at 2005-04-26 21:56:42 cin>>temp会不会读到回车符?
> #include <iostream.h>
>
> int num[104][104];
>
> void main()
> {
> int i,j;
> int n,m;
> char temp;
> int sum=0;
> cin>>n>>m;
> for(i=1;i<=n;i++)
> {
> for(j=1;j<=m;j++)
> {
> cin>>temp;
> if(temp=='W')
> num[i][j]=1;
> else
> num[i][j]=-1;
> }
> }
> for(i=1;i<=n;i++)
> for(j=1;j<=m;j++)
> {
> if(num[i][j]==1)
> {
> if(num[i][j-1]==1 || num[i-1][j]==1 || num[i-1][j-1]==1 || num[i-1][j+1]==1)//判断之前出现的相邻点是否有'W'
> continue;
> else//没有就加一个湖
> sum++;
> }
> }
> cout<<sum;
> }
>
>
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator