Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <list>
- using namespace std;
- int hashf(int n) {
- int k = n % 10 + ((n / 10) % 10) * 100 + (n / 100) % 10 * 100 + (n / 1000) % 10 * 1000;
- return k;
- }
- vector <vector <int>> hasht;
- int main() {
- ifstream inp("input.txt");
- ofstream outp("output.txt");
- int a;
- while (true) {
- inp >> a;
- if (a == 0) break;
- else if (a > 0) {
- hasht[hashf(a)].push_back(a);
- }
- else {
- for (int i = 0; i < hasht[hashf(-a)].size(); ++i) {
- if (-a == hasht[hashf(-a)][i]) {
- }
- }
- }
- }
- inp.close();
- outp.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement