結果

問題 No.436 ccw
ユーザー tak0kada
提出日時 2017-01-14 17:17:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 69,064 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-21 12:43:28
合計ジャッジ時間 1,601 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int solve(string input)
{
    int pos_first = input.find("ccw");
    int pos_last = input.rfind("ccw");
    int length = input.length();
    
    if (pos_first > length)
        return 0;
    else
        return min(pos_last + 1, length - pos_first - 2);
}

int main(void)
{
    string input;
    cin >> input;
    cout << solve(input) << endl;
}
0