結果
問題 |
No.2608 Divide into two
|
ユーザー |
![]() |
提出日時 | 2024-01-20 02:19:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 245 ms |
コンパイル使用メモリ | 41,928 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-28 05:22:57 |
合計ジャッジ時間 | 626 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 |
ソースコード
/* -*- coding: utf-8 -*- * * 2608.cc: No.2608 Divide into two - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 100; /* typedef */ /* global variables */ int as[MAX_N]; /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n; scanf("%d", &n); int s = n * (n + 1) / 2; if (s & 1) { puts("-1"); continue; } int t = s / 2; fill(as, as + n, 0); for (int i = n; i >= 1; i--) if (t >= i) { as[i - 1] = 1; t -= i; } for (int i = 0; i < n; i++) printf("%d", as[i]); putchar('\n'); } return 0; }