結果

問題 No.2608 Divide into two
ユーザー yansi819
提出日時 2024-03-16 12:31:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 547 bytes
コンパイル時間 1,964 ms
コンパイル使用メモリ 191,952 KB
最終ジャッジ日時 2025-02-20 06:47:53
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int N, t;
string T;

int main(void){
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> N;
    T = "";
    if (N % 4 == 0 || N % 4 == 3) {
      for (int j = 1; j <= N; j++) {
        if (N % 4 == 0) {
          if (j % 4 == 0 || j % 4 == 1) T += '0';
          else T += '1';
        } else {
          if (j % 4 == 0 || j % 4 == 3) T += '0';
          else T += '1';
        }
      }
      cout << T << endl;
    } else {
      cout << -1 << endl;
    }
  }
  return 0;
}
0