結果

問題 No.1992 Tendon Walk
ユーザー take000
提出日時 2022-12-27 22:39:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 2,150 ms
コンパイル使用メモリ 193,276 KB
最終ジャッジ日時 2025-02-09 21:12:06
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int X;
    cin >> X;

    int cur = 0, ans = 0;
    vector<int> d = {2, 2, -1, -1, 2, -1, -1};
    int idx = 0;
    while (cur != X) {
        cur += d[idx];
        ans += abs(d[idx]);
        idx = (idx + 1) % 7;
    }
    cout << ans << "\n";

    return 0;
}
0