| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪里有错啊,实在看不出来!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator