Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4. #include <list>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int hashf(int n) {
  10. int k = n % 10 + ((n / 10) % 10) * 100 + (n / 100) % 10 * 100 + (n / 1000) % 10 * 1000;
  11. return k;
  12. }
  13.  
  14. vector <vector <int>> hasht;
  15.  
  16. int main() {
  17. ifstream inp("input.txt");
  18. ofstream outp("output.txt");
  19.  
  20. int a;
  21. while (true) {
  22. inp >> a;
  23. if (a == 0) break;
  24. else if (a > 0) {
  25. hasht[hashf(a)].push_back(a);
  26. }
  27. else {
  28. for (int i = 0; i < hasht[hashf(-a)].size(); ++i) {
  29. if (-a == hasht[hashf(-a)][i]) {
  30.  
  31. }
  32. }
  33. }
  34.  
  35. }
  36. inp.close();
  37. outp.close();
  38.  
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement