結果
| 問題 | 
                            No.1992 Tendon Walk
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mmn15277198
                         | 
                    
| 提出日時 | 2022-07-25 22:00:55 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 305 bytes | 
| コンパイル時間 | 1,476 ms | 
| コンパイル使用メモリ | 167,344 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-08 00:44:54 | 
| 合計ジャッジ時間 | 2,000 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 6 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x;
  cin >> x;
  vector<int> a =  {2,2,-1,-1,2,-1,-1};
  int now = 0;
  int ans = 0;
  int i = 0;
  while (true) {
    now += a[i];
    ans += abs(a[i]);
    if (now == x) break;
    i = (i + 1) % 7;
  }
  cout << ans << endl;
  return 0;
}
            
            
            
        
            
mmn15277198