This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///a と b の最大公約数を求める | |
fn gcd(a: usize, b: usize) -> usize { | |
if a % b == 0 { | |
b | |
} else { | |
gcd(b, a % b) | |
} | |
} | |
///ループ処理 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::boxed::Box; | |
macro_rules! Ch { | |
($x:expr, $y:expr, $z:expr) => { ($x & $y) ^ (!$x & $z) }; | |
} | |
macro_rules! Maj { | |
($x:expr, $y:expr, $z:expr) => { ($x & $y) ^ ($x & $z) ^ ($y & $z) }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::path::Path; | |
use std::fs::File; | |
use std::io::BufRead; | |
use std::io::BufReader; | |
/// &str 型から char 型に変換 | |
/// # Panics | |
/// 文字列が1文字ではなかった場合、 panic を発生させる。 | |
fn get_char(s: &str) -> char { |