結果

問題 No.1159 Sashiming String
ユーザー SSRS
提出日時 2020-11-10 07:49:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 64,640 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 17:11:44
合計ジャッジ時間 1,400 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#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