Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:在本机上各种情况都试了,为甚提交就是wrong answer?

Posted by chenyiting at 2018-12-25 08:10:18 on Problem 1753
In Reply To:在本机上各种情况都试了,为甚提交就是wrong answer? Posted by:zhaone at 2018-08-05 18:10:39
> #include <stdio.h>
> #include <vector>
> using namespace std;
> 
> int main(int argc, char const *argv[]){
> 	vector< vector<int> > primal(4, vector<int>(4));
> 	vector< vector<int> > press(5, vector<int>(6));
> 	int pressNum;
> 	int mmin = 20;
> 	char bw;
> 	bool succ;
> 	for (int i = 0; i < 4; i++){
> 		for (int j = 0; j<4; j++)
> 			primal[i][j]=((bw=getchar())=='b'?1:0);
> 		getchar();
> 	}
> 	for (int i = 0; i<5; i++)
> 		for (int j = 0; j<6; j++)
> 			press[i][j] = 0;
> 
> 	for (int i = 0; i<16; i++){
> 		int tmp = i;
> 		pressNum = 0;
> 		//第一行
> 		for (int j = 1; j<5; j++){
> 			pressNum += press[1][j] = tmp & 1;
> 			tmp = tmp >> 1;
> 		}
> 		for (int j = 2; j<5; j++){
> 			for (int k = 1; k<5; k++){
> 				if (0 == (primal[j - 2][k - 1] + press[j - 1][k - 1] + press[j - 1][k] + press[j - 1][k + 1] + press[j - 2][k]) % 2){
> 					press[j][k] = 1;
> 					pressNum++;
> 				}
> 				else{
> 					press[j][k] = 0;
> 				}
> 			}
> 		}
> 		succ=true;
> 		for(int j=0; j<4; j++){
> 			if (0==(primal[3][j] + press[4][j+1] + press[4][j] + press[4][j+2] + press[3][j+1])%2){
> 				succ=false;
> 			}
> 		}
> 		if(succ){
> 			mmin=min(mmin,pressNum);
> 		}
> 	}
> 	if(mmin>16)
> 		printf("Impossible");
> 	else
> 		printf("%d\n", mmin);
> 	return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator