Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <stdio.h>
- #include <stdlib.h>
- using namespace std;
- int main() {
- string s;
- cin >> s;
- int n;
- cin >> n;
- string a[n];
- bool ok = true;
- for(int i = 0; i < n; i++) {
- cin >> a[i];
- if(s == a[i]) {
- ok = false;
- }
- }
- if(ok) {
- cout << s << endl;
- return 0;
- }
- for(int i = 1; i <= 201; i++) {
- string str = "";
- int x = i;
- while(x > 0) {
- str += (x % 10) + '0';
- x /= 10;
- }
- reverse(str.begin(), str.end());
- string tmp = s + str;
- bool moze = true;
- for(int j = 0; j < n; j++) {
- if(tmp == a[j]) {
- moze = false;
- }
- }
- if(moze) {
- cout << tmp << endl;
- break;
- }
- }
- return 0;
- }
- /// YNYYYNYNY
Advertisement
Add Comment
Please, Sign In to add comment