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

求大神指点下,自己跑的没问题啊,wa了好几次了

Posted by l942345 at 2013-11-17 09:11:46 on Problem 2864
#include <iostream>
#include<cstdio>
using namespace std;
int a[500][100];
int flag[500]={0};

int main(int argc, const char * argv[])
{
    int N,D;
    int b = 0;
    int c =0;
    int f = 0;
    while (scanf("%d%d",&N,&D)&&(N!=0)&&(D!=0)) {
        for(int i = 0;i<D;i++)
            for(int j = 0;j<N;j++)
                cin>>a[i][j];
        for(int i = 0;i<D;i++)
            for(int j = 0;j<D;j++)
                {
                    b =b+a[i][j];
                    if(b == N)
                    {
                        flag[i] = 1;
                    }
                                }
        for(int i = 0;i<D;i++)
        {
            c = c+flag[i];
            if(c == 0);
            else
            { f =1;}
            }
        if(f == 1)
            printf("yes");
        else
            printf("no");
        b=0;
        c=0;
        f=0;
        for(int j = 0;j<D;j++)
            flag[j] =0;
            
    }

    // insert code here...
    //std::cout << "Hello, World!\n";
    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