結果

問題 No.2297 Best Grouping
ユーザー Lisp_CoderLisp_Coder
提出日時 2023-05-13 19:11:34
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 1,682 bytes
コンパイル時間 13,630 ms
コンパイル使用メモリ 397,192 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-06 23:48:27
合計ジャッジ時間 14,643 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 0 ms
6,940 KB
testcase_09 AC 0 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 0 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 0 ms
6,944 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 AC 1 ms
6,944 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

#[allow(dead_code)]
// 文字列を読み込む関数
fn read_string() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().to_string()
}
#[allow(dead_code)]
// 整数を読み込む関数
fn read<T: std::str::FromStr>() -> T {
    let s = read_string();
    s.parse().ok().unwrap()
}
#[allow(dead_code)]
// スペース区切りの整数を読み込む関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let s = read_string();
    s.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
// 文字列を出力する関数
fn out(s: &str) {
    println!("{}", s);
}
#[allow(dead_code)]
// 整数を出力する関数
fn outi<T: std::fmt::Display>(n: T) {
    println!("{}", n);
}
#[allow(dead_code)]
// スペース区切りの整数を出力する関数
fn out_vec<T: std::fmt::Display>(v: Vec<T>) {
    let mut s = String::new();
    for i in 0..v.len() {
        s += &v[i].to_string();
        if i != v.len() - 1 {
            s += " ";
        }
    }
    println!("{}", s);
}
#[allow(dead_code)]
// 改行区切りの整数を出力する関数
fn out_vec2<T: std::fmt::Display>(v: Vec<T>) {
    for i in 0..v.len() {
        println!("{}", v[i]);
    }
}
#[allow(dead_code)]
// 2次元配列を出力する関数
fn out_vec3<T: std::fmt::Display>(v: Vec<Vec<T>>) {
    for i in 0..v.len() {
        for j in 0..v[i].len() {
            print!("{} ", v[i][j]);
        }
        println!("");
    }
}

fn main() {
    let n = read::<usize>();
    if n % 3 == 0 {
        out("0");
    } else if n % 3 == 1 {
        out("2");
    } else {
        out("1");
    }
}
0