結果

問題 No.1469 programing
ユーザー kenichikenichi
提出日時 2023-12-01 17:25:17
言語 Rust
(1.77.0)
結果
AC  
実行時間 243 ms / 3,000 ms
コード長 2,166 bytes
コンパイル時間 1,024 ms
コンパイル使用メモリ 184,800 KB
実行使用メモリ 31,140 KB
最終ジャッジ日時 2023-12-01 17:25:20
合計ジャッジ時間 2,607 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 8 ms
6,676 KB
testcase_09 AC 9 ms
6,676 KB
testcase_10 AC 9 ms
6,676 KB
testcase_11 AC 19 ms
6,676 KB
testcase_12 AC 15 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 26 ms
6,676 KB
testcase_15 AC 16 ms
6,676 KB
testcase_16 AC 26 ms
6,676 KB
testcase_17 AC 243 ms
31,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;
use std::str::FromStr;

/*
const LOW_CASE_ALPHABET: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];
*/
//static fib: Vec<u64>;

//use std::io::{self, BufRead};

fn main() {
    let s: Vec<char> = read_array();
    if s.len() != 1{
        for _i in 0..s.len() - 1{
            if s[_i] == s[_i + 1]{
                continue;
            }
            print!("{}",s[_i]);
        }
        if s[s.len() - 2] != s[s.len() - 1]{
            print!("{}",s[s.len() - 1]);
        }
        if s[s.len() - 2] == s[s.len() - 1]{
            print!("{}",s[s.len() - 1]);
        }
    }else{
        print!("{}",s[0])
    }
    

}

/*
pub fn legendre(mut n: usize, p: usize) -> usize {
    let mut res = 0;
    while n != 0 {
        res += n / p;
        n /= p;
    }
    return res;
}

pub fn euclid(a: usize, b: usize) -> usize {
    if b == 0 {
        return a;
    } else {
        return euclid(b, a % b);
    }
}

pub fn calc_divisors_number(n: usize) -> usize {
    let mut res = 0;
    for _i in 1..=((n as f64).sqrt() as usize) {
        if n % _i != 0 {
            continue;
        }

        if n / _i != _i {
            res += 2;
        } else {
            res += 1;
        }
    }

    return res;
}

pub fn calc_divisors(n: usize) -> Vec<usize> {
    let mut res = Vec::new();
    for _i in 1..=((n as f64).sqrt() as usize) {
        if n % _i != 0 {
            continue;
        }
        res.push(_i);
        if n / _i != _i {
            res.push(n / _i);
        }
    }
    res.sort();
    return res;
}
*/

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


pub fn read_array() -> Vec<char> {
    let array: String = read();
    let chars: Vec<char> = array.trim().chars().collect::<Vec<char>>();
    chars
}
0