結果

問題 No.1159 Sashiming String
ユーザー DaYuanChiDaYuanChi
提出日時 2021-04-02 00:25:32
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 167,732 KB
実行使用メモリ 4,780 KB
最終ジャッジ日時 2023-08-23 07:17:36
合計ジャッジ時間 2,369 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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