| ||||||||||
| 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 | |||||||||
简单的写法In Reply To:我认为评测机有问题,一直wrong,重金求解答为什么错 Posted by:yangmin5416 at 2019-02-28 23:16:30 #include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
const int MAXN=5;
int map[MAXN][MAXN];
queue<pair<int,int> > Q;
int main()
{
memset(map,0,sizeof(map));
char c;
for (int i=1;i<=4;i++)
for (int j=1;j<=4;j++)
{
c=getchar();
while (c!='-'&&c!='+')c=getchar();
if (c=='+')
{
map[i][j]=1-map[i][j];
for (int k=1;k<=4;k++)
{
map[i][k]=1-map[i][k];
map[k][j]=1-map[k][j];
}
}
}
int ans=0;
for (int i=1;i<=4;i++)
for (int j=1;j<=4;j++)
if (map[i][j]==1)
{
ans++;
Q.push(make_pair(i,j));
}
printf("%d\n",ans);
pair<int,int> top;
while (!Q.empty())
{
top=Q.front();Q.pop();
printf("%d %d\n",top.first,top.second);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator