結果

問題 No.1159 Sashiming String
ユーザー SSRS
提出日時 2020-11-10 07:49:50
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 6 ms / 2,000 ms
+ 403µs
コード長 274 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 431 ms
コンパイル使用メモリ 78,464 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-11-04 17:19:33
合計ジャッジ時間 2,047 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;
int main(){
	string S;
	cin >> S;
	int N = S.size();
	int cnt = 0;
	long long ans = 0;
	for (int i = 0; i <= N - 3; i++){
		if (S[i] == 'S'){
			cnt++;
		}
		if (S.substr(i, 3) == "ing"){
			ans += cnt;
		}
	}
	cout << ans << endl;
}
0