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 |
重磅来袭!!!#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