Advertisement
Hippskill

Untitled

Jan 27th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #define _USE_MATH_DEFINES
  3. #include<stdio.h>
  4. #include<iostream>
  5. #include<vector>
  6. #include<cmath>
  7. #include<algorithm>
  8. #include<map>
  9. #include<set>
  10. #include<sstream>
  11. #include<cstring>
  12. #include<numeric>
  13. #include<limits.h>
  14. using namespace std;
  15.  
  16. const int N = 5e5;
  17.  
  18. char a[N];
  19. set<int> to, from;
  20. int main() {
  21.     freopen("out.txt", "w", stdout);
  22.     freopen("Text.txt", "r", stdin);
  23.  
  24.     scanf("%s", a);
  25.    
  26.     for (int i = 0; i <= 9999; i++) {
  27.         to.insert(i);
  28.     }
  29.  
  30.     int len = strlen(a);
  31.     for (int i = 0; i < len; i++) {
  32.         for (int ln = 0; ln < 4; ln++) {
  33.             int cur = 0;
  34.             for (int j = i; j <= i + ln; j++) {
  35.                 cur *= 10;
  36.                 cur += a[j] - '0';
  37.             }
  38.             from.insert(cur);
  39.         }
  40.     }
  41.  
  42.     for (auto c : to) {
  43.         if (from.count(c) == 0) {
  44.             printf("%d\n", c);
  45.         }
  46.     }
  47.  
  48.  
  49.  
  50.  
  51.  
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement