Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int, int>
- #define pb(x) push_back(x)
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvl(vector <ll> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvv(vector <vector <int> > &v) {
- for (auto x : v) cv(x);
- cout << "\n";
- }
- void cvb(vector <bool> v) {
- for (bool x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvs(vector <string> v) {
- for (auto a : v) {
- cout << a << "\n";
- }
- }
- void cvp(vector <pii> a) {
- for (auto p : a) {
- cout << p.first << ' ' << p.second << "\n";
- }
- cout << "\n";
- }
- bool ok(vector <vector <int> > dp, int a2, int b1) {
- dp[0][1] = b1;
- dp[1][0] = a2;
- for (int j = 2; j <= 4; ++j) {
- dp[0][j] = dp[0][j - 1] + 1;
- }
- for (int i = 2; i <= 4; ++i) {
- dp[i][0] = dp[i - 1][0] + 1;
- }
- for (int i = 1; i <= 4; ++i) {
- for (int j = 1; j <= 4; ++j) {
- dp[i][j] = dp[i][0] % dp[0][j];
- }
- }
- return dp[4][1] == 5 && dp[4][2] == 3 && dp[4][3] == 1 && dp[4][4] == 18;
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- vector <vector <int> > dp(10, vector <int> (10, 0));
- for (int a2 = 1; a2 < 1000; ++a2) {
- for (int b1 = 1; b1 < 1000; ++b1) {
- if (ok(dp, a2, b1)) {
- cout << "OK\n";
- cout << a2 << ' ' << b1;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement