結果

問題 No.1376 Simple LPS Problem
ユーザー wotsushi
提出日時 2020-11-07 12:43:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 2,209 ms
コンパイル使用メモリ 195,864 KB
最終ジャッジ日時 2025-01-15 21:29:25
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 60
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const string T = "110100";

int main() {
  int N, K;
  cin >> N >> K;
  string S;
  if (2 * K >= N) {
    S = string(K, '0') + string(N - K, '1');
  } else if (N <= 8 and K == 3) {
    S = "00010" + string(N - 5, '1');
  } else if (N >= 9 and K >= 4) {
    S = string(K, '0');
    for (int i = 0; S.size() < N; i = (i + 1) % T.size()) {
      S.push_back(T[i]);
    }
  } else {
    S = "-1";
  }
  cout << S << endl;
}
0