はまやんはまやんはまやん

hamayanhamayan's blog

Exchange [Tenka1 Programmer Beginner Contest B]

https://beta.atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_b

解説

https://beta.atcoder.jp/contests/tenka1-2018-beginner/submissions/3509545

シミュレートしよう。

int A, B, K;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B >> K;
    rep(i, 0, K) {
        if (i % 2 == 0) {
            if (A % 2 == 1) A--;
            B += A / 2;
            A /= 2;
        } else {
            if (B % 2 == 1) B--;
            A += B / 2;
            B /= 2;
        }
    }
    cout << A << " " << B << endl;
}