結果

問題 No.2608 Divide into two
ユーザー yansi819yansi819
提出日時 2024-03-16 12:31:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 547 bytes
コンパイル時間 2,390 ms
コンパイル使用メモリ 202,284 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-16 12:31:47
合計ジャッジ時間 3,182 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

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