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 kabar at 2012-08-18 10:27:47 on Problem 1552
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

int main(){
    int n,ans=0,con=0,s[20];
    while(cin>>n){
        if(n==-1) break;
        s[con++]=n;
        if(n==0){
            if(con==1) cout<<"0"<<endl;
            else{
                sort(s,s+con-2);
                for(int i=0;i<con-1;i++){
                    for(int j=i+1;j<con-1;j++){
                        if(1.0*s[j]/s[i]==2){
                            ans++;
                        }
                    }
                }
                cout<<ans<<endl;
                memset(s,0,20);
                ans=0,con=0;
            }
        }
    }
    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