Codeforces Round #487 (Div. 2)

Link


A

签到


B

无脑模拟即可


C  构造

分析

考虑将整张图先分成四个区域A,B,C,D,然后直接往里面填充,但要考虑怎么放可以使当前的区域一直为1,一直只改变填充的字符,pp构造的真牛逼啊,

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[]) {
  std::ios_base::sync_with_stdio(false);
  vector<int> a(4);
  for (int i = 0; i < 4; i++) {
    cin >> a[i];
    a[i]--;
  }
  cout << "48 50" << endl;
  for (int i = 0; i < 4; i++) {
    int v = a[(i + 1) % 4];
    cout << string(50, 'A' + i) << endl;
    for (int j = 0; j < 10; j++) {
      cout << (char)('A' + i);
      for (int k = 0; k < 48; k++) {
        if (j % 3 < 2 && ((j % 3 + k) & 1) && v > 0) {
          v--;
          cout << (char)('A' + (i + 1) % 4);
        } else {
          cout << (char)('A' + i);
        }
      }
      cout << (char)('A' + i) << endl;
    }
    cout << string(50, 'A' + i) << endl;
  }
  return 0;
}

 

posted @ 2018-06-11 22:57  Deadlined  阅读(163)  评论(0编辑  收藏  举报