結果

問題 No.522 Make Test Cases(テストケースを作る)
ユーザー gyu-dongyu-don
提出日時 2017-07-23 21:04:23
言語 Rust
(1.77.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 541 bytes
コンパイル時間 10,041 ms
コンパイル使用メモリ 393,508 KB
最終ジャッジ日時 2024-04-27 02:28:19
合計ジャッジ時間 12,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
error[E0782]: trait objects must include the `dyn` keyword
 --> src/main.rs:5:30
  |
5 | fn main_() -> Result<(), Box<Error>> {
  |                              ^^^^^
  |
help: add `dyn` keyword before this trait
  |
5 | fn main_() -> Result<(), Box<dyn Error>> {
  |                              +++

For more information about this error, try `rustc --explain E0782`.
error: could not compile `main` (bin "main") due to 1 previous error

ソースコード

diff #

use std::error::Error;
use std::io;
use std::io::Write;

fn main_() -> Result<(), Box<Error>> {
    let mut s = String::new();
    io::stdin().read_line(&mut s)?;
    let stdout = io::stdout();
    let mut stdout = stdout.lock();
    let n: u32 = s.trim().parse()?;
    for a in 1..(n-1) {
        for b in a..(n-a) {
            let c = n - a - b;
            if b <= c {
                writeln!(stdout, "{} {} {}", a, b, n-a-b)?;
            }
            else { break; }
        }
    }
    Ok(())
}

fn main() {
    main_().unwrap();
}
0