Test instructions
A total of n stamps were collected, and now 2 were lost, leaving N-2 Zhang ... the stamps originally collected were all collected in pairs, so the two types of stamps were found to be single and output. (Make sure the missing stamps are not the same)
Ideas
Because the number is larger, you can use the hash table to compress the size of the group can be opened. Compression is just as good as taking the mold. If the conflict goes to the next look.
Code
#include <cstdio>#include <cstring>#define MOD 1000007Const intMAXN =1000010;structNode {intCntintNum;}; Node S[MAXN];intMain () {intNscanf("%d", &n); for(inti =0; I < n2; i + +) {intAscanf("%d", &a);//???? intAhash = A%mod; while(S[ahash].num! = a && S[ahash].num! =0) {Ahash + +; Ahash = AHASH%MAXN; } s[ahash].num = A; S[ahash].cnt + +; }BOOLFirst =true; for(inti =0; i < MAXN; i + +) {if(s[i].cnt%2) {if(first) {first =false;printf("%d", S[i].num); }Else printf("%d\n", S[i].num); } }return 0;}
NOJ1184 Lost stamp Hash list