結果

問題 No.1992 Tendon Walk
ユーザー みここ
提出日時 2022-07-01 21:24:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 63,996 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 03:39:29
合計ジャッジ時間 985 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

const int d[7] = {2, 2, -1, -1, 2, -1 -1};

int main()
{
    int x;
    cin >> x;
    int a = 0;
    int ans = 0;
    for(int i = 0; i < 1000; i++)
    {
        if(a == x)
        {
            cout << ans << endl;
            return 0;
        }
        a += d[i % 7];
        ans += abs(d[i % 7]);
    }
}
0