結果
問題 | No.599 回文かい |
ユーザー | aimy |
提出日時 | 2017-11-24 23:50:41 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,548 bytes |
コンパイル時間 | 15,446 ms |
コンパイル使用メモリ | 385,068 KB |
実行使用メモリ | 16,324 KB |
最終ジャッジ日時 | 2024-11-27 08:34:36 |
合計ジャッジ時間 | 69,540 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
8,612 KB |
testcase_01 | AC | 1 ms
8,608 KB |
testcase_02 | AC | 1 ms
8,612 KB |
testcase_03 | AC | 1 ms
13,636 KB |
testcase_04 | WA | - |
testcase_05 | TLE | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | TLE | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
evil_0.txt | TLE | - |
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:33:9 | 33 | buf.trim_right().parse::<T>().ok().unwrap() | ^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 33 | buf.trim_end().parse::<T>().ok().unwrap() | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:48:22 | 48 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 48 | let mut it = buf.trim_end().split_whitespace(); | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:66:22 | 66 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 66 | let mut it = buf.trim_end().split_whitespace(); | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:85:9 | 85 | buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 85 | buf.trim_end().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:100:9 | 100 | buf.trim_right().chars().collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 100 | buf.trim_end().chars().collect() | ~~~~~~~~
ソースコード
fn main() { let s = get::val::<String>(); let mut ans = 1; kaibun(&mut ans, &s[..], 0, s.len()); println!("{}", ans) } fn kaibun(ans: &mut usize, s: &str, l: usize, r: usize) { let d = r - l; for i in 1 .. (d+1)/2 { let mut m = 0; if s[l..l+i] != s[r-i..r] { continue } else { m += 1; //println!("{} {}", &s[l..l+i], &s[r-i..r]); kaibun(ans, &s[..], l+i, r-i) } *ans = (*ans + m) % 1_000_000_007; } } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; pub fn val<T: FromStr>() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().parse::<T>().ok().unwrap() } pub fn vals<T: FromStr>(n: usize) -> Vec<T> { let mut vec: Vec<T> = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); (x, y) } pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); let z = it.next().unwrap().parse::<T3>().ok().unwrap(); (x, y, z) } pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn list<T: FromStr>() -> Vec<T> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() } pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> { let mut mat: Vec<Vec<T>> = vec![]; for _ in 0 .. h { mat.push(list()); } mat } pub fn chars() -> Vec<char> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().chars().collect() } }