結果

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

ソースコード

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