Monday 4 May 2009

POJ 1552


#include <iostream>
using namespace std;
int main() {
for(int n,m;cin>>n&&n!=-1;){
bool a[101]={0};
a[n]=true; m=0;
for(;cin>>n&&n;a[n]=true);
for(int i=1,j=2;i<=50;++i,j+=2) if(a[i]&&a[j])++m;
cout<<m<<endl;
}
return 0;
}

No comments:

Post a Comment