結果
問題 |
No.1020 Reverse
|
ユーザー |
![]() |
提出日時 | 2020-04-10 21:23:46 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 13,705 ms |
コンパイル使用メモリ | 377,824 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 16:48:39 |
合計ジャッジ時間 | 14,769 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
use std::io::Read; fn run() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let n: usize = it.next().unwrap().parse().unwrap(); let k: usize = it.next().unwrap().parse().unwrap(); let mut s: Vec<char> = it.next().unwrap().chars().collect(); s.rotate_left(k - 1); if (n - k + 1) % 2 != 0 { s[(n - k + 1)..].reverse(); } let ans: String = s.into_iter().collect(); println!("{}", ans); } fn main() { run(); }