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

我哪里没有初始化吗?怎么会运行不了

Posted by on_pku at 2009-10-18 10:26:55 on Problem 1656
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int size = 105;
bool isBlack[size][size];

int main()
{
    int n,x,y,L,count;
    char command[10];
    
    for(int i = 0; i < size; i++)
            for(int j = 0; j < size; j++)
                    isBlack[i][j] = false;
    cin >> n;
    
    while(n--){
               cin >> command >> x >> y >> L;
              
                       if(strcmp(command,"BLACK")== 0){ 
                            for(int i = x; i <= x+L-1; i++)
                                         for(int j = y; i <= y+L-1; j++)
                                                 isBlack[i][j] = true;
                       }
                          
                       else if(strcmp(command,"WHITE")== 0){ 
                            for(int i = x; i <= x+L-1; i++)
                                         for(int j = y; i <= y+L-1; j++)
                                                 isBlack[i][j] = false; 
                       }
                               
                       else if(strcmp(command,"TEST") == 0){ 
                            count = 0;
                            for(int i = x; i <= x+L-1; i++)
                                         for(int j = y; i <= y+L-1; j++)
                                                 if(isBlack[i][j])count ++;
                            cout << count << endl;
                       }                       
    } 
    system("pause");   
    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