結果
問題 |
No.2608 Divide into two
|
ユーザー |
|
提出日時 | 2024-07-25 10:41:23 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 20,805 ms |
コンパイル使用メモリ | 394,444 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-07-25 10:41:45 |
合計ジャッジ時間 | 13,920 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 |
ソースコード
use std::io::Read; fn a(n: usize) { let mut c = vec!['0'; n]; let (mut a, mut b) = (0, 0); for i in (1..=n).rev() { if a > b { b += i; continue; } c[i - 1] = '1'; a += i } println!( "{}", if a == b { c.iter().collect::<String>() } else { "-1".to_owned() } ); } fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); s.lines().skip(1).flat_map(str::parse::<usize>).for_each(a) }