結果
問題 | No.1491 銀将 |
ユーザー | Strorkis |
提出日時 | 2021-04-30 21:45:07 |
言語 | Rust (1.83.0 + proconio) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,228 bytes |
コンパイル時間 | 12,738 ms |
コンパイル使用メモリ | 387,920 KB |
最終ジャッジ日時 | 2024-11-15 05:10:11 |
合計ジャッジ時間 | 13,570 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
error: format argument must be a string literal --> src/main.rs:10:34 | 10 | Err(e) => panic!(e), | ^ | help: you might be missing a string literal to format with | 10 | Err(e) => panic!("{}", e), | +++++ error: could not compile `main` (bin "main") due to 1 previous error
ソースコード
pub mod io {use std::io::{BufRead, ErrorKind};pub fn scan<R: BufRead>(r: &mut R) -> String {let mut res = Vec::new();loop {let buf = match r.fill_buf() {Ok(buf) => buf,Err(e) if e.kind() == ErrorKind::Interrupted => continue,Err(e) => panic!(e),};let (done, used, buf) = {match buf.iter().position(u8::is_ascii_whitespace) {Some(i) => (i | res.len() > 0, i + 1, &buf[..i]),None => (buf.is_empty(), buf.len(), buf),}};res.extend_from_slice(buf);r.consume(used);if done {return String::from_utf8(res).unwrap();}}}#[macro_export]macro_rules! scan {($r:expr) => (io::scan(&mut $r));($r:expr, $($t:ty),*) => (($(scan!($r).parse::<$t>().unwrap()),*));}}fn main() {let stdin = std::io::stdin();let mut reader = std::io::BufReader::new(stdin.lock());let k = scan!(reader, u64);let n = 2 * k - 1;let ans = n * n + 2 * (n + 1) + (n + 2) / 2 - (k - 1);println!("{}", ans);}