結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    
    int x;cin>>x;
    
    string str ="AABBABB";
    
    int now = 0;
    int dist = 0;
    while(1){
        for(int i=0;i<str.size();i++){
            if(str[i]=='A') {
                now+=2;
                dist+=2;
            }else {
                now-=1;
                dist+=1;
            }
            if(now==x) {
                cout << dist << endl;
                return 0;
            }
        }
    }
}
0