結果

問題 No.682 Average
ユーザー nekoziroonekoziroo
提出日時 2018-05-26 12:51:45
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 14,445 ms
コンパイル使用メモリ 377,884 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 18:09:50
合計ジャッジ時間 14,147 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::f32;
use std::io::stdin;

fn get_line() -> String {
    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    line
}

fn main() {
    let line = get_line();
    let line: Vec<&str> = line.split_whitespace().collect();

    let a: i16 = line[0].parse().unwrap();
    let b: i16 = line[1].parse().unwrap();

    let mut result = 0;
    for i in a..b + 1 {
        let sum = a + b + i;
        let average = sum as f32 / 3.0;
        if average.fract() == 0.0 {
            result += 1;
        }
    }
    println!("{}", result);
}
0