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 w57w57w57 at 2008-12-08 22:04:44 on Problem 1552
#include<iostream>
#include<memory>
using namespace std;
main()
{
    int tag[101];
    int number;
    memset(tag,0,101);
    while(cin>>number,number!=-1)
    {
        if(0==number)
        {
            int ans = 0;
            for(int i=1;i<=50;i++)
            {
                if(tag[i]==1&&tag[2*i]==1)
                {
                    ans++;
                }    
            } 
            cout<<ans<<endl;   
            memset(tag,0,101);
        } 
        else
        {
            tag[number] = 1;
        }       
    }  
    //system("pause");  
}    

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