0
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/09/14

0
Posted at

AtCoder

AtCoder Beginner Contest 200

A - Century

  • ABC前の指慣らし
  • 100で割った余りで分類すればよい
int main() {
    long long N;
    cin >> N;
    if (N % 100 == 0){
        cout << N / 100 << endl;
    }
    else{
        cout << N / 100 + 1 << endl;
    }
}

B - 200th ABC-200

  • ABC前の指慣らし
  • 文字列変換も考えたが一番実装が楽なのは既存のNを1000倍したものに200を足す。
int main() {
    long long N,K;
    cin >> N >> K;
    for (long long i = 0;i < K;i++){
        if (N % 200 == 0){
            N /= 200;
        } else {
            N = N * 1000 + 200;
        }
    }
    cout << N << endl;
}

C - Ringo's Favorite Numbers 2

  • ABC前の指慣らし兼典型90問(046 - I Love 46(★3))の類題
  • 046 - I Love 46(★3)と同じく各数字を200で割った余りで分類する。今回は差が200の倍数かどうかなので分類が同じ(割った余りが同じ)ものの中から組み合わせを考えれば答えがでる
int main() {
    long long N;
    cin >> N;
    vector<long long> A(N);
    long long ans = 0;
    for (long long i = 0; i < N;i++){
        cin >> A[i];
    }
    vector<long long> Ai(200), Aj(200);
    for (long long i = 0; i < N;i++){
        Ai[A[i] % 200]++;
    }
    for (long long i = 0; i < 200;i++){
        ans += (Ai[i] * (Ai[i] - 1)) / 2;
    }
    cout << ans << endl;
}

AtCoder Beginner Contest 008

C - コイン

  • 難しい!解説読んでもよくわからなかった!というか典型90問で解いた問題の類題だから解いたけど確認したら水Diffだった!
  • 解説読んでもわからなかったから何も書けない。すみません。とりあえず未来の自分に託します。
0
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
0
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?