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:超简单的方法!

Posted by w57w57w57 at 2008-12-10 20:03:06 on Problem 1552
In Reply To:超简单的方法! Posted by:changzhiwin at 2008-07-23 17:43:10
我的和你的差不多,为什么我的就不能AC??
#include<iostream>
#include<memory>
using namespace std;
main()
{
    int tag[100];
    int number;
    memset(tag,0,sizeof(tag));
    while(cin>>number)
    {
        if(-1 == number)
        {
            break;
        }    
        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,sizeof(tag));
        } 
        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