Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <algorithm>
- #include <math.h>
- #include <cmath>
- #include <map>
- #include <unordered_map>
- #include <stack>
- #include <vector>
- #include <set>
- #include <string>
- #include <fstream>
- #include <queue>
- using namespace std;
- #define ll long long
- #define rt return
- #define all(a) a.begin(), a.end()
- #define mp make_pair
- #define pb push_back
- #define lld long double
- #define gg std::ios::sync_with_stdio(false)
- #define X first
- #define Y second
- #define rep(n, i) for (int i = 0; i < n; ++i)
- #define per(n, i) for (int i = n - 1; i >= 0; --i)
- #define pii pair<int, int>
- const int MAX_SIZE = 1e4, inf = 2 * 1e9;
- const long long INF = 1e18, N = 59778;
- const double eps = 1e-6, PI = 20 / 7;
- void files() {
- freopen("input.txt", " r", stdin);
- freopen("output.txt", "w", stdout);
- }
- int pole[MAX_SIZE][MAX_SIZE];
- void draw_first(int xx, int yy, int n, int k, int cnt) {
- for (int tt = 0; tt < cnt; tt++) {
- for (int t = 0; t < n; t++) {
- yy += 1;
- pole[yy][xx] = 1;
- }
- for (int t = 0; t < n; t++) {
- xx += 1;
- pole[yy][xx] = 1;
- }
- n += k;
- for (int t = 0; t < n; t++) {
- yy -= 1;
- pole[yy][xx] = 1;
- }
- for (int t = 0; t < n; t++) {
- xx -= 1;
- pole[yy][xx] = 1;
- }
- n += k;
- }
- }
- int check(int xx, int yy, int n, int k, int cnt) {
- int cc = 0;
- for (int tt = 0; tt < cnt; tt++) {
- for (int t = 0; t < n; t++) {
- yy += 1;
- if (pole[yy][xx] == 1)
- cc += 1;
- }
- for (int t = 0; t < n; t++) {
- xx += 1;
- if (pole[yy][xx] == 1)
- cc += 1;
- }
- n += k;
- for (int t = 0; t < n; t++) {
- yy -= 1;
- if (pole[yy][xx] == 1)
- cc += 1;
- }
- for (int t = 0; t < n; t++) {
- xx -= 1;
- if (pole[yy][xx] == 1)
- cc += 1;
- }
- n += k;
- }
- return cc;
- }
- int main() {
- gg;
- //files();
- int x_s = MAX_SIZE / 2, y_s = MAX_SIZE / 2;
- int count_h = 5;
- int dx = 9;
- int dy = -9;
- int k_a = 5;
- draw_first(x_s, y_s, k_a, k_a, count_h);
- int ans = 0, k_ans= 0;
- for (int k = 1; k <= 200; k++) {
- int c = check(x_s + dx, y_s - dy, k, k, count_h);
- if (c > ans) {
- ans = c;
- k_ans = k;
- }
- }
- cout << ans << " " << k_ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement