2023-02-25 AGC022 の A を解いた / nostr のクライアントの進捗
AGC022 : AtCoder Grand Contest 022 の A を解いた。
- A - Diverse Word
https://atcoder.jp/contests/agc022/tasks/agc022_a- 提出: https://atcoder.jp/contests/agc022/submissions/39199960
- 未使用のものを追加または一文字進める
 
use proconio::{input, marker::Chars};
fn main() {
    input! {
        s: Chars,
    };
    let mut used = vec![false; 26];
    for c in s.iter().copied() {
        used[(c as u8 - b'a') as usize] = true;
    }
    for (i, b) in used.iter().copied().enumerate() {
        if !b {
            print!("{}", s.into_iter().collect::<String>());
            println!("{}", (i as u8 + b'a') as char);
            return;
        }
    }
    for (i, c) in s.iter().copied().enumerate().rev() {
        for j in (c as u8) + 1..=b'z' {
            if !used[(j - b'a') as usize] {
                for k in 0..i {
                    print!("{}", s[k]);
                }
                println!("{}", j as char);
                return;
            }
        }
        used[(c as u8 - b'a') as usize] = false;
    }
    println!("-1");
}
bouzuya/rust-sandbox で nostrs という nostr のクライアントを書いている。次の機能を追加した。
- nostrs contact list
- nostrs keypair create
- nostrs text-note create
- nostrs text-note delete
- nostrs text-note like
crates:nostr-sdk を使っているのだけど、小さいコメントの修正を Pull Request した。
https://github.com/rust-nostr/nostr/pull/54
例によってひな人形を出した (2022-03-01, 2021-03-03, 2020-03-03, 2019-02-20) 。
今日のコミット。
- rust-sandbox 11 commits- nostrs: Add text-note like command
- nostrs: Add text-note delete command
- nostrs: Add contact list command
- nostrs: Fix to use Metadata struct
- nostrs: Extract dirs mod
- nostrs: Add contact list command
- nostrs: Add README
- nostrs: Add keypair create command
- nostrs: cargo update
- nostrs: Fix text_note list command to make events unique
- nostrs: Add text_note create command
 
- rust-atcoder 1 commit