結果

問題 No.2035 Tunnel
ユーザー Carpenters-Cat
提出日時 2022-08-12 22:28:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 2,275 ms
コンパイル使用メモリ 192,464 KB
最終ジャッジ日時 2025-01-30 21:21:22
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 5 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    string s;
    cin >> s;
    long long ans = 0;
    long long las = -1;
    for (int i = N - 1; i >= 0; i --) {
        if (s[i] == '#') {
            if (i < N - 1 && s[i + 1] == '#') {
                las ++;
            } else {
                las = 0;
            }
            ans = las + N - i;
        }
    }
    cout << ans << endl;
}
0