标签:des style class c blog code
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 18824 | Accepted: 10846 |
Description
1 4 3 2 9 7 18 22
Input
Output
Sample Input
1 4 3 2 9 7 18 22 0 2 4 8 10 0 7 5 11 13 1 3 0 -1
Sample Output
3 2 0
Source
#include <iostream> #include<cstring> using namespace std; int main() { int a[20]; cin>>a[0]; while(a[0]!=-1) { int n =1; int ans = 0; for(;;n++) { cin>>a[n]; if(a[n]==0) break; } for(int i=0;i<n-1;i++) { for(int j=i+1;j<n;j++) if(a[i]*2==a[j]||a[i]==a[j]*2) ans++; } cout<<ans<<endl; memset(a,0,sizeof(a)); cin>>a[0]; } return 0; }
标签:des style class c blog code
原文地址:http://www.cnblogs.com/jhldreams/p/3748082.html