結果

問題 No.2608 Divide into two
ユーザー 👑 tipstar0125tipstar0125
提出日時 2024-01-19 22:03:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 855 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 64,828 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-19 22:03:11
合計ジャッジ時間 1,288 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;

int main()
{
    int T;
    cin >> T;

    while (T--)
    {

        int N;
        cin >> N;
        int n = 0;
        for (int i = 1; i <= N; i++)
        {
            n += i;
        }
        if (n % 2 == 0)
        {
            if (n / 2 <= N)
            {
                for (int i = 0; i < n / 2; i++)
                {
                    cout << 0;
                }
                for (int i = 0; i < N - n / 2; i++)
                {
                    cout << 1;
                }
                cout << endl;
            }
            else
            {
                for (int i = 0; i < N; i++)
                {
                    cout << 0;
                }
                cout << endl;
            }
        }
        else
        {
            cout << -1 << endl;
        }
    }
}
0