QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#100468#5563. K.O. KidsPetroTarnavskyi#WA 2ms3432kbC++17598b2023-04-26 14:49:172023-04-26 14:49:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-26 14:49:21]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3432kb
  • [2023-04-26 14:49:17]
  • 提交

answer

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

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	string s;
	cin >> n >> k >> s;
	FOR(i, 0, n - 1) {
		if (s[i] == s[i + 1]) {
			k--;
		}
	}
	cout << max(0, k) << "\n";
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3412kb

input:

3 5
LRL

output:

5

result:

ok single line: '5'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3352kb

input:

3 2
RRR

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3416kb

input:

3 5
LLL

output:

3

result:

ok single line: '3'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3432kb

input:

8 7
LLRLLLRR

output:

3

result:

ok single line: '3'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

5 1
LRLRL

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3264kb

input:

5 1
LRLRR

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3288kb

input:

5 5
LLRLL

output:

3

result:

ok single line: '3'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3356kb

input:

10 10
LLRRLLRRRR

output:

4

result:

ok single line: '4'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3416kb

input:

10 1
LLLLRRLRRL

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3352kb

input:

10 20
LLRRLLLRLR

output:

16

result:

ok single line: '16'

Test #11:

score: -100
Wrong Answer
time: 2ms
memory: 3352kb

input:

10 30
RRRLLLLRRL

output:

24

result:

wrong answer 1st lines differ - expected: '23', found: '24'