結果

問題 No.1159 Sashiming String
ユーザー DaYuanChi
提出日時 2021-04-02 00:25:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 1,986 ms
コンパイル使用メモリ 169,668 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-21 07:53:53
合計ジャッジ時間 2,660 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int a[200005];

int main(){
  string s; cin >> s;
  vector<int> t;
  for(int i = 0; i < s.size(); i++){
    if(s[i]=='S') t.push_back(0);
    if(s[i]=='i' && s[i+1]=='n' && s[i+2]=='g') t.push_back(1);
  }
  int n = t.size();
  int cnt = 0;
  for(int i = n-1; i>=0; i--){
    if(t[i]==1) cnt++;
    a[i] = cnt;
  }
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(t[i]==0) ans += a[i];
  }
  cout << ans << endl;
  return 0;
} 
0