結果

問題 No.752 mod数列
ユーザー 特命ログイン特命ログイン
提出日時 2018-11-09 22:41:49
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 702 bytes
コンパイル時間 3,519 ms
コンパイル使用メモリ 138,536 KB
実行使用メモリ 6,436 KB
最終ジャッジ日時 2023-08-13 11:56:50
合計ジャッジ時間 4,984 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,392 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 40 ms
4,376 KB
testcase_07 AC 36 ms
4,380 KB
testcase_08 AC 17 ms
4,376 KB
testcase_09 AC 29 ms
4,376 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{Read,stdin};

fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    let mut tok = buf.split_whitespace();
    let mut get = || tok.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let p = get!();
    let q = get!();
    for _ in 0..q {
        let li = get!();
        let ri = get!();
        if p < li {
            let ans = (ri - li + 1) * p;
            println!("{}", ans);
        } else {
            let mut ans = 0;
            for i in li..=ri {
                ans += p % i;
            }
            println!("{}", ans);
        }
        
    }

}
0