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 |
边看电影边写代码,竟然一次 0 MS AC,黄河之水天上来~#include <iostream> using namespace std; int main() { bool have[100]; int arr[15]; int i, j; int count ; while (cin>>arr[0] && arr[0]!=-1) { memset(have, false, sizeof(have)); have[arr[0]] = true; count = 0; i=1; while (cin>>arr[i] && arr[i]!=0) { have[arr[i]] = true; i++; } for (j=0; j<=i-1; j++) { if (arr[j]%2==0 && have[arr[j]/2]) { count++; } } cout<<count<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator