結果

問題 No.2608 Divide into two
ユーザー ripity
提出日時 2024-01-19 22:46:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 1,000 ms
コード長 544 bytes
コンパイル時間 2,001 ms
コンパイル使用メモリ 193,232 KB
最終ジャッジ日時 2025-02-18 21:26:33
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void solve() {
    int N;
    cin >> N;
    if( N%4 == 0 ) {
        for( int i = 0; i < N/4; i++ ) cout << "0110";
        cout << "\n";
    }else if( N%4 == 3 ) {
        cout << "110";
        for( int i = 0; i < (N-3)/4; i++ ) cout << "0110";
        cout << "\n";
    }else {
        cout << "-1\n";
    }
}

int main() {
    int T;
    cin >> T;
    while(T--) { solve(); }
}

/*

N * (N + 1) / 2

N mod 4 が 0, 3

1 2 3 4 5 6 7

0 は簡単 (0110 を繰り返す)
3 は 1 2 3 で調整

*/
0