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?

More than 1 year has passed since last update.

競プロ日記#25/07/31

0
Posted at

AtCoder

AtCoder Beginner Contest 372

B - 3^A

  • 記数法。Mを3進数に直したときの各位の数字分3^kの値をpushしていく
  • ただの数学問題で解説もちゃんと読めば理解できるけど流し見だとあんまりよくわからない。こういう問題をB問題に持ってくるの大分あれだなって感じ

AtCoder Beginner Contest 370

B - Binary Alchemy

  • 最近競プロに時間を割けていないからこのレベルの問題でも問題設定と意味を理解するのにも複雑さを幹事というか時間がかかるようになっている...つらい
  • とはいえ372のB問題とは違って割と素直に実装するだけだったので問題なし
  • 二次元配列を定義するときのサイズと添え字に注意するくらいで特筆すべき点はなし
int main() {
    long long N;
    cin >> N;
    vector<vector<long long>> A(N + 1, vector<long long>(N + 1));
    for (long long i = 1; i <= N; i++) {
        for (long long j = 1; j <= i; j++) {
            cin >> A[i][j];
        }
    }
    long long K;
    for (long long i = 1; i <= N; i++) {
        if (i == 1){
            K = A[i][1];
        } else {
            if (i < K){
                K = A[K][i];
            }else{
                K = A[i][K];
            }
        }
    }
    cout << K << endl;
}
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?