1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

競プロ日記#25/06/28

Posted at

AtCoder

AtCoder Beginner Contest 378

A - Pairing

int main() {
    int N = 4;
    map<int, int> mp;
    for (int i = 1; i <= N; i++) {
        int A;
        cin >> A;
        mp[A]++;
    }
    int ans = 0;
    for (auto& [key, value] : mp) {
        if (value == 4){
            ans += 2;
        }
        if (value == 3){
            ans += 1;
        }
        if (value == 2){
            ans += 1;
        }
    }

    cout << ans << endl;
}
  • ACはしたけど流石にA問題でMapを使わなければならないということはないのでちゃんと解説を読んだ

B - Garbage Collection

  • 上手い考え方が見つからず
    1.dをt種類目のqで割った商を求める
    2.1で求めた商にqを掛けたものにrを足したものを求める
    3.2で求めたものがdよりも小さければ商に1を加えた上で2と同様の操作をしたものを答えとする。
    というすごく愚直なやり方をした。
  • 一応ACしたが納得していない
  • と思ったが解説を見ても概ね同じようなやり方だったのでそういうものなのかもしれない
  • 余談だがこの問題だったり本日開催のABC412だったり、最近B問題程度ですら手こずることが多くなってきて普通に脳の病気的なものを自分で疑うくらい思考力や集中力が落ちているような気がする。恐らくメンタル的な調子が良くないせいだと思う。
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?