QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#153240#6867. String Problemneko_nyaaAC ✓6ms3744kbC++23516b2023-08-29 19:11:242023-08-29 19:11:25

Judging History

你现在查看的是最新测评结果

  • [2023-08-29 19:11:25]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3744kb
  • [2023-08-29 19:11:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long
const int M = 998244353;
int modpow(int n, int k) {
	int ans = 1;
	while (k) {
		if (k % 2) ans = (ans*n) % M;
		n = (n*n) % M; k /= 2;
	}
	return ans;
}

void solve() {
	string s; cin >> s;
	int ans = 0;
	for (int i = 1; i < s.size(); i++) {
		if (s[i] == s[i-1]) ans++;
	}
	cout << ans << '\n';
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);

	int t; cin >> t;
	while (t--) {
		solve();
	}

	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 6ms
memory: 3744kb

input:

16
abcdefg
pqtcuxgggzxwviimecjcewjagmkozprogmrcjzjsagqvozkubvxitikzuxpwogkuudzgfiyfqodgnparkxbdilceisaxantvqsdxcbdspgyfvzyhyzkgkolvinujangtijqkkvfbddiaeghffrnsgapoojzqwhlgsetezygfdofkvnpcgewohlfvuentobzgfslgstlwhrgeexjmbfbirgflmvecwgjdawjtpvrymxfswoezthimnpycmeekmnnnlxgaszzewgyuuctpkdczvcdhgistxfijc...

output:

0
3845
3864
3765
25214
25033
1
1
24911
5041
4981
9999
9999
3829
3872
3856

result:

ok 16 lines