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 |
这样写行不行?不过wa#include <iostream> #include <map> using namespace std; int P; int count = 0; int main(int argc, char* argv[]) { map<int, int> book; cin>>P; int index = 0; while(index < P) { int a; cin>>a; if(book.find(a) == book.end()) { book[a] = a; count++; } index++; } 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