Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- #include <string>
- #include <algorithm>
- using namespace ::std;
- int main()
- {
- int n, j;
- string data[100];
- bool r = false;
- cin >> n;
- for (int i = 0; i <= 99; i++)
- data[i] = "80";
- for (int i = 1; i <= 99 - n; i++)
- {
- for (j = 0; j < n; j++)
- {
- if ((i + j) % 10 == 1 || (i + j) % 10 == 0 || (i + j) % 10 == 6 || (i + j) % 10 == 8 || (i + j) % 10 == 9)
- {
- if ((i + j) / 10 == 1 || (i + j) / 10 == 0 || (i + j) / 10 == 6 || (i + j) / 10 == 8 || (i + j) / 10 == 9)
- {
- data[j + 1][1] = (i + j) % 10 + '0';
- data[j + 1][0] = (i + j) / 10 + '0';
- }
- else
- break;
- }
- else
- break;
- }
- if (j == n)
- {
- r = true;
- break;
- }
- }
- if (r == true)
- for (int k = n; k >=1; k--)
- {
- if (data[k][1] == '6')
- {
- cout << 9;
- }
- else
- if (data[k][1] == '9')
- cout << 6;
- else
- cout << data[k][1];
- if (data[k][0] == '6')
- cout << 9 << " ";
- else
- if (data[k][0] == '9')
- cout << 6 << " ";
- else
- cout << data[k][0] << " ";
- }
- else
- cout << "Glupenky Pierre";
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment