結果

問題 No.495 (^^*) Easy
ユーザー airisairis
提出日時 2017-03-24 23:10:39
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 144,916 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 03:14:19
合計ジャッジ時間 2,222 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

string s;
string LEFT = "(^^*)";
string RIGHT = "(*^^)";
int ansl, ansr;

void solve() {
	int size= s.size();
	for (int i = 0; i <= size - (int)LEFT.size(); i+=LEFT.size()) {
		string sub = s.substr(i, LEFT.size());
		if (sub == LEFT) ansl++;
		else ansr++;
	}
	cout << ansl << " " << ansr << endl;
}

int main() {
	cin >> s;
	solve();
	return 0;
}


0