提出 #60300376
ソースコード 拡げる
#[allow(unused_imports)]
use proconio::{input, marker::Chars};
fn main() {
input!{
n: usize,
d: usize,
s: Chars,
}
let count = s.iter().filter(|&c| *c == '.').count();
println!("{}", count + d);
}
pub trait Debuggable {
fn debug_string(&self) -> String;
}
impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for Vec<T> {
fn debug_string(&self) -> String {
use itertools::Itertools;
use std::iter::repeat;
if let Some(max_size) = self.iter()
.map(|x| format!("{:?}", x).len())
.max() {
let mut idx = String::from("idx |");
let mut val = String::from("val |");
for (i, xi) in self.iter().enumerate() {
idx.push_str(
&format!(" {:>w$} |", i, w=max_size)
);
val.push_str(
&format!(" {:>w$} |", xi, w=max_size)
);
}
format!("{}\n{}\n{}\n", idx, repeat('-').take(idx.len()).join(""), val)
} else {
format!("idx | \nval |\n")
}
}
}
impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for std::collections::BTreeSet<T> {
fn debug_string(&self) -> String {
use itertools::Itertools;
format!("{{ {} }}", self.iter().join(", "))
}
}
impl<T, U> Debuggable for std::collections::BTreeMap<T, U>
where T: std::fmt::Debug + std::fmt::Display, U: std::fmt::Debug + std::fmt::Display
{
fn debug_string(&self) -> String {
use itertools::Itertools;
format!(
"{{\n{}\n }}", self.iter()
.map(|(k, v)| format!("{k} -> {v}, "))
.join("\n")
)
}
}
// lg! マクロの定義
#[macro_export]
macro_rules! lg {
($val:expr) => {
#[cfg(feature = "local")]
{
{
use Debuggable;
let val = &$val;
eprintln!(
"[{}:{}] {} = \n{}",
file!(),
line!(),
stringify!($val),
val.debug_string()
);
val
}
}
}
}
提出情報
提出日時
2024-11-30 21:01:31+0900
問題
A - Daily Cookie
ユーザ
ardRiriy
言語
Rust (rustc 1.70.0)
得点
100
コード長
2274 Byte
結果
AC
実行時間
1 ms
メモリ
2076 KiB
コンパイルエラー
warning: unused variable: `n`
--> src/main.rs:6:9
|
6 | n: usize,
| ^ help: if this is intentional, prefix it with an underscore: `_n`
|
= note: `#[warn(unused_variables)]` on by default
ジャッジ結果
セット名
Sample
All
得点 / 配点
0 / 0
100 / 100
結果
セット名
テストケース
Sample
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt
ケース名
結果
実行時間
メモリ
00_sample_00.txt
AC
1 ms
1732 KiB
00_sample_01.txt
AC
1 ms
1852 KiB
00_sample_02.txt
AC
1 ms
1884 KiB
01_random_00.txt
AC
1 ms
2060 KiB
01_random_01.txt
AC
0 ms
1928 KiB
01_random_02.txt
AC
0 ms
1996 KiB
01_random_03.txt
AC
0 ms
1972 KiB
01_random_04.txt
AC
0 ms
1936 KiB
01_random_05.txt
AC
0 ms
1928 KiB
01_random_06.txt
AC
1 ms
1972 KiB
01_random_07.txt
AC
1 ms
1896 KiB
01_random_08.txt
AC
0 ms
1916 KiB
01_random_09.txt
AC
1 ms
2076 KiB
02_handmade_00.txt
AC
0 ms
1932 KiB
02_handmade_01.txt
AC
0 ms
2012 KiB
02_handmade_02.txt
AC
1 ms
2044 KiB
02_handmade_03.txt
AC
0 ms
1928 KiB
02_handmade_04.txt
AC
0 ms
1864 KiB