結果

問題 No.1109 調の判定
ユーザー
提出日時 2024-06-06 11:22:51
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 13,858 ms
コンパイル使用メモリ 378,676 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 02:30:03
合計ジャッジ時間 15,819 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable does not need to be mutable
 --> src/main.rs:6:6
  |
6 |     let mut n = s.split_whitespace().skip(1).flat_map(str::parse::<u8>);
  |         ----^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

ソースコード

diff #

use std::io::Read;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let mut n = s.split_whitespace().skip(1).flat_map(str::parse::<u8>);
	let mut a = -1;
	for d in 0..12 {
		if n.clone()
			.any(|t| matches!((t + 12 - d) % 12, 1 | 3 | 6 | 8 | 10))
		{
			continue;
		}
		if a != -1 {
			a = -1;
			break;
		}
		a = d as i8;
	}
	println!("{a}")
}
0