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 |
ACIn Reply To:边看电影边写代码,竟然一次 0 MS AC,黄河之水天上来~ Posted by:gfedcba at 2009-01-12 22:40:27 #include <iostream> #include <vector> using namespace std; void input(); void solve(); vector<int> list; vector<int> listD; int tmp; int main() { while (cin>>tmp) { if (tmp==-1) break; list.push_back(tmp); input(); solve(); list.clear(); listD.clear(); } return 0; } void input() { while (cin>>tmp) { if (tmp==0) return; else list.push_back(tmp); } } void solve() { int res=0; for (int i=0;i<list.size();i++) { listD.push_back(list[i]*2); } for (int i=0;i<list.size();i++) { for (int j=0;j<listD.size();j++) { if (list[i]==listD[j]) res++; } } cout<<res<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator