QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#166864#6867. String ProblemPPP#AC ✓3ms3812kbC++17663b2023-09-06 19:36:062023-09-06 19:36:08

Judging History

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

  • [2023-09-06 19:36:08]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3812kb
  • [2023-09-06 19:36:06]
  • 提交

answer

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n;
ll k;
const int maxN = 1e5 + 10;
int A[maxN];
int B[maxN];
void solve() {
    string s;
    cin >> s;
    int n = s.size();
    n--;
    for (int i = 1; i < s.size(); i++) {
        if (s[i] != s[i - 1]) n--;
    }
    cout << n << '\n';
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    int tst;
    cin >> tst;
    while (tst--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3812kb

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