結果

問題 No.2608 Divide into two
ユーザー MitarushiMitarushi
提出日時 2022-08-26 18:58:10
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 362 bytes
コンパイル時間 2,929 ms
コンパイル使用メモリ 65,600 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-07 15:37:01
合計ジャッジ時間 3,537 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import strutils

proc solve()=
    let n = stdin.readLine.parseBiggestInt
    if n mod 4 == 1:
        echo -1
        return
    var s = n * (n + 1) div 4
    var result = '0'.repeat(n)
    for i in countdown(n, 1):
        if i <= s:
            result[i-1] = '1'
            s -= i
    echo result

let t = stdin.readLine.parseInt
for _ in 0..<t:
    solve()
0