結果

問題 No.495 (^^*) Easy
ユーザー d_sei
提出日時 2019-08-21 11:52:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 690 ms
コンパイル使用メモリ 75,148 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-08 09:35:27
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
using namespace std;
typedef long long int lont;
int main() {
	string S;
	cin >> S;
	int Z = S.size();
	int cnta = 0;
	int cntb = 0;
	if (Z==0) {
		cout << 0<<" "<<0 << endl;
	}
	else {
		for (int ia = 0; ia < Z - 5; ia++) {
			if (S.at(ia) == '(' &&
				S.at(ia + 1) == '^' &&
				S.at(ia + 2) == '^' &&
				S.at(ia + 3) == '*' &&
				S.at(ia + 4) == ')') {
				cnta++;
			}
			else if (S.at(ia) == '(' &&
				S.at(ia + 1) == '*' &&
				S.at(ia + 2) == '^' &&
				S.at(ia + 3) == '^' &&
				S.at(ia + 4) == ')') {
				cntb++;
			}
		}
		cout << cnta << " " << cntb << endl;
	}
}
0