結果

問題 No.2608 Divide into two
ユーザー ripityripity
提出日時 2024-01-19 22:46:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 544 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 201,004 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-19 22:46:28
合計ジャッジ時間 2,683 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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;

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