QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#278006#5563. K.O. Kidsjzh#AC ✓0ms3860kbC++23470b2023-12-07 10:36:492023-12-07 10:36:50

Judging History

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

  • [2023-12-07 10:36:50]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3860kb
  • [2023-12-07 10:36:49]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, k; cin >> n >> k;
	string s; cin >> s;
	s = "R" + s;

	int last = 0,ans = 0;
	char now = 'R';
	for(int i = 1 ; i <= k ; i ++) {
		if(last==n) {
			ans++;
			continue;
		}
		while(last<n and s[last+1]!=now) {
			now = s[last+1];
			last++;
		}
		if(last==n) ans++;
		if(last<n) last++;
	}
	cout << ans << endl;

	return 0;
}

详细

Test #1:

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

input:

3 5
LRL

output:

5

result:

ok single line: '5'

Test #2:

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

input:

3 2
RRR

output:

0

result:

ok single line: '0'

Test #3:

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

input:

3 5
LLL

output:

3

result:

ok single line: '3'

Test #4:

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

input:

8 7
LLRLLLRR

output:

3

result:

ok single line: '3'

Test #5:

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

input:

5 1
LRLRL

output:

1

result:

ok single line: '1'

Test #6:

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

input:

5 1
LRLRR

output:

0

result:

ok single line: '0'

Test #7:

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

input:

5 5
LLRLL

output:

3

result:

ok single line: '3'

Test #8:

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

input:

10 10
LLRRLLRRRR

output:

4

result:

ok single line: '4'

Test #9:

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

input:

10 1
LLLLRRLRRL

output:

0

result:

ok single line: '0'

Test #10:

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

input:

10 20
LLRRLLLRLR

output:

16

result:

ok single line: '16'

Test #11:

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

input:

10 30
RRRLLLLRRL

output:

23

result:

ok single line: '23'

Test #12:

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

input:

10 5
LRRLLRLLRL

output:

2

result:

ok single line: '2'

Test #13:

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

input:

30 30
LRRLRLLLLRRRRRLLRLLLRLLRRLLLLR

output:

14

result:

ok single line: '14'

Test #14:

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

input:

30 50
RLRRRRRLRLLLRRRRRLLLRLLRRLLLLR

output:

32

result:

ok single line: '32'

Test #15:

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

input:

30 10
LLRRRRLLLRLRRRLRLLRLLLRRRLLRRR

output:

0

result:

ok single line: '0'

Test #16:

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

input:

30 500
RLLLRRRRRRLRRLRLRRLLRRLRLRRLLL

output:

485

result:

ok single line: '485'

Test #17:

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

input:

30 1000
RRLRLRRRLLLLLLRLRRRLLLLLRLLRLL

output:

983

result:

ok single line: '983'

Test #18:

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

input:

100 500
LRRRRLRRRRRRLLRRLLRLRLRLRLLRLRRRLRLLRLLRLLRLRLRLLRRRLRLRLRRRLLLRRRLLLLRRLRLLLRLLRLLRLRLRLRRLRLLLRLLL

output:

461

result:

ok single line: '461'

Test #19:

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

input:

100 1000
RLLLLRRRRRRLLRLLLLRLRLRLRRRLRLLRLLLLLLLLRRRLRRLRLRLLRRLRRLLRLLLLLRRRRLRRRRLLLRLLRRRRLLLRLLRLLRRLLRLR

output:

948

result:

ok single line: '948'

Test #20:

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

input:

100 10
LLLLRLLRLRLRLRLLRRRRLLRLRLRRRRRRLRRRRRRRLRRLRRLRRLLRLLRRLRRRRLLRLLLRLLRLRLRLLRLLLLLLRRLLLRRLLLRLLLRR

output:

0

result:

ok single line: '0'

Test #21:

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

input:

100 50
LLLLRRRLRRRLLLRLLLLRRRLLLLRRLRLRLRRRLLRLRLLRRRRLRRRRRRRLLLLRLRLRLLLLRLRRRRLRLRRRLLLLLLRLRRRRRLLLLLLL

output:

0

result:

ok single line: '0'

Test #22:

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

input:

100 200
LRLLLLLRRLRLRRLRLRRLLRLRLRLLRLLRRRLRRRRLLRLRLRLLRRRLLRRLLRLLLRRLLRLRLLRLRLLRRLLRLLRLRRRLLLRLRRRRRLLR

output:

160

result:

ok single line: '160'

Test #23:

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

input:

100 400
LRLRRLLLLRLLLLRLLRLLLLRRLLRLRLRLLRRRRRRRRLLRLRRRRLLLLRRLLLRRLRLRRLLLLLLLRRRRRRLLRLLRRRRRLRRRRRRLLRRL

output:

343

result:

ok single line: '343'

Test #24:

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

input:

100 150
LLLLRRRLRRLRRLLRRRLLRLRLLLRRLLLRLRLRRLRLLLLLLLRLLLLRRRLLLRLRLLLLRRRLLRLRLLRRRLLRLLLRLRLRLLRLRLRRRRRR

output:

102

result:

ok single line: '102'

Test #25:

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

input:

100 300
RLLRRLLLLRLRLRRRRRLLLRLLLLRLLRRRRLLLRLLLRLLLLLLRRLRLRLRLRLLLRLRLRRRRLLRRRRRLRLLRRRRLLLRRRRLLRRRLRRRL

output:

247

result:

ok single line: '247'

Test #26:

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

input:

100 700
LRLLLRLRRLRRLLLRRRRRRLRRRRLRLLLLLRLLRRLRRRLLLRLRLLLRRRLLRRRLLRRRRRLLLRRRRLRLLLLRRRRRLRLLLRRRRLRLLLRL

output:

645

result:

ok single line: '645'

Test #27:

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

input:

100 80
RLRLRLLLLRRLRRLLRRRRLRRRRRRLRLRRRRRRRLRRLLLRLLRRLRLRLRLLLRRRLRRRRLLLLRRLRRLRLRLLRLRLLRLLRLLRRLLRRLRR

output:

34

result:

ok single line: '34'

Test #28:

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

input:

500 500
LLLLRLLLRLLRRLLLLRRLLRLRLLRRRLRLRLRLLRRRRLRLRLRLLRLRLLRLLLLLLRLLRLRLLRLRRLRLRRRRRRLLRRLLLLLLRRRLRRRRLLRRRRLLLRLLLRLLLLLLRRLRRRLRLRRLLRRLRLLRLLRRRRRRRRRLRRLRLRLLRRLLRRRRLLRLLRLLLLLRRRLLRRLRRLLLRRRRLLRLLLRLLRRRLLRLRRRRLLLRLLRLLRLRLRLRLRLRRLLLLRLRRLRLRRLRRRLLRLLRLLLLRRLLLRRLRLRLRLLLLRLLRLLRLRRL...

output:

269

result:

ok single line: '269'

Test #29:

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

input:

500 100
LRRLLLLLRLRRRLLRRLLRLRLLLRRLLRRLLLRLLRLLRRRLRRRRRRRRLLLRLRRLRRLLRRRLRLRLLRLLLLLLRRLLLLRRLRLLLRRLLLRRRLLRLRRRRLRLLRRRRLRRLLRRLRLRLLRLRLRRLRLRRLRRRLLLLLRLRLLLLRLLLRRLLRRRLRLLLRLLLLLRRRLLLLRLLLRRLRRLRRRLRRRLLRLRRLRRLLLRLLLRLRRRRLLLLLRLRRLRRLLLRLLRLRLRLLLRRRRRRRLLLLRRRRLLLLRLRRLLLLRRRRRLRRRRRRLL...

output:

0

result:

ok single line: '0'

Test #30:

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

input:

500 1000
LLLLRRRLRRLRRRRRRLRRRLLLLLRRLRRLLRRRLLLRRLLRRRRRLLLRLRLLLRRRLRLRRRRRRRRLLRRRRRLLRLRRLRRRLLRRRLLLLLRRRLRLRLRLLLRRLLRLRRRLRLLLLLRRLRLRLLRRRLRLLRRRRLRLRLRLLRRRRRRRLLLLRRRRLRLLRLLRRLRLLLRRLRLLRRLLRRRRLLRRLLRLRLLRRRRLLLRRRRLLRRLLRRLLLLRLRLLLLRRLRRRRRLLLLLRLLRLRRLRLRLLRLRRRRRLLRRLLRRRLRLRRLRLRRLL...

output:

744

result:

ok single line: '744'

Test #31:

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

input:

500 800
LLRLRRRLRRLRLRRRLLRRLRLLRLRRRRRRLLRLLRRRRRRLRLRRRRLRRRLRLLLRRLRRRLRRLLLLRLRRLLLLLRRLRRRLRLLLLLRRLRRLLRRLRLRLLRRLLLLLRLLRLLRLRRLLLLLLRRRRLLRLRLRLRRRRRRLLRLLRLRRLLLRRLRRLLRRLLLLLRLLLLRRLRRRRLRRLLRLRRLLRLLRLRLLRLLRRLLRRLLLRRRLRRRRRRRRRRRRLLRRRRLLLLLLRRRRLLRRLRRLLLRLRRRRLLRLRLRRLLRRLRRLLLLLLRLRL...

output:

540

result:

ok single line: '540'

Test #32:

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

input:

500 200
LLLLRRRRLLRRLLRRRLRLLRLLRLRRLLRRRLRRRLLRLRLLLRRRLRRLLRLLLRRLRLLLLRLRLLLLLRLRRRRRLLLLLLLLLRRLLRRRLLRLLLRRLRRLRLRLLLRRRLRLLLRLLRRRLLLRLRLRRRRLLRLRLRRRLRLLRLLRRRRRLLLRLRRRRLRRLRLLRRLLRLRLRLRRRRRRLLLLLRLRLLRRRLLLRRLRLRLLRRLRRLRRLRRRLLLRLRLRLLRRRLRLLLLRRRLLRLRRLRLLLRLRRRRRLLRLLRRLRRLRRRRLLRRLLLRL...

output:

0

result:

ok single line: '0'

Test #33:

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

input:

1000 1000
LRLLRLLRLLRRRRRRRRRLLRRLRLRLRRLRRRLLLLLRLLRLRLRLLRLRRRRLLRRRLLLRRRLLRLRRLLLRLLLLRLLLRLRRLLRLRLLRLLRRLLRLRLRLLLRLLRLRRRLRRLRLLLRLLLRRRRLLRLLRLRLRRRRRLRRRLRRLRRLRLLLRRLLLRRRRRLLLRLRRLRRLLRRRLLLLLLLLRRRRLRRLRLRLRLLLLLRLLRRRRRRRRLRLLRRLRRRRRLRRLRRLRLRLRLLLLRLRRRLRRLRRLRRRLLLRLLLRLRRLRRLLLLLRRL...

output:

495

result:

ok single line: '495'

Test #34:

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

input:

1000 500
LLRRLLLLRRRLRRLRRLRLRLRRLLLLRRRRLLRLRLLLRRRRRRLRRLRRLLLLLLLLLRRRLRRRLLRLRRLRRRRLLLRLRRRRRRLRLRRRLLLRLRRLRRLRLRRRRLLRLRLRRRRRLRRLLLLRRRRLLRRRLLRRRRLRLRLRLRLRLLLRLRRLLLLLLRLLLLRRRLRRRLLRLLRRLRLRLLLLLRLRLLRRRLRLRLRLRLLRRLRLLLRRRRRRRLRRRRLLRLLLLRLRLLRRRRRRLLRLRLLRLLRLLLLRRLRLLLRLRRRLRLLRLRRRRLL...

output:

0

result:

ok single line: '0'

Test #35:

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

input:

1000 300
LLLLLLLLLLLLRLLLLLRRRRLRLLRRLLRLLLRLRLRRRRRRLLLLRLLLLLRLRLRRLRLLRRLLRRLRLRRRRRRRLRLRLLLLLRRLLRRRLLLLLRLLRRLLRLRLRRLRLLLLRLLLLLLRLRLLLLLLLLLRLRLLLRLLLLRRLRLRRLRRRRRRRLLLLLLLRRRLRRLRLRLLLLRLLLRLRRRLLLRRRRRRLRRLRLRLLLRRLLRRRLLRLLRLLLLLRLRRLLRLRLLRRLLRRRLLLLRLLLRRRLLLLLLRLLRLLLRRRRLRLLLLLLLRRLL...

output:

0

result:

ok single line: '0'

Test #36:

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

input:

1000 100
RRLRRLLLRRLRLRLLRRRRRRRLLRLRRLLLLLLRLRLRLLRLLLRRLRLLRRRRRRLLRLRRLLRRLLRLRLRRLRLLRLRRRRRLRLRRRRLLLLRRLLRRLLRLLLRRRRRRLLRLRLRRRLLLRRRLRRRLLRRRRLRRRLRRLLRLRLRLRRRRRLRLLLRLRRLLLRLLRRLRRRRLRRLLLLRLLLRLLRRRRLLRRRLLRRRLRRLRRRLLLLRRRLLLLLLRRLLLRRRRRLRRLLRLRRRLRRLLLRRRRLRLRLLLLRRRLLRRLRLRLLRRRRLRLLL...

output:

0

result:

ok single line: '0'

Test #37:

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

input:

1000 10
LLLRRRLLRRRLRLLLLRLLRRLLLRRLLRLLRRRRRLLRRLLLLRLLLLRLLRRLLRRRLLRRRRLLLRLLRLLLRRRRLLLRLRRRLLLRRLRRLLRLRLLLLLLLLLLRLRRRLLLLLRLRLLLLRLLLRRLLRLRRLLRRRRLRLRLRRRLLRLRLRRRRLLRRLRLRRRLRLLLLLLRRRLLLLRLRLLLRRLLLRLLLLRRRLRRLRRLLRRRRLRRLLRLLRRRRRRLRRRLRLLRLRLRLLLRLRLRLRLRLLRLLRRLRLRLLLLRRRRLRLLLLLRLRLLRL...

output:

0

result:

ok single line: '0'

Test #38:

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

input:

1000 1000
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

999

result:

ok single line: '999'

Test #39:

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

input:

1000 1000
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

1000

result:

ok single line: '1000'

Test #40:

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

input:

1000 250
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

249

result:

ok single line: '249'

Test #41:

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

input:

1000 250
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

250

result:

ok single line: '250'

Test #42:

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

input:

1000 50
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

49

result:

ok single line: '49'

Test #43:

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

input:

1000 50
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

50

result:

ok single line: '50'

Test #44:

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

input:

1000 250
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

output:

0

result:

ok single line: '0'

Test #45:

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

input:

1000 50
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

output:

0

result:

ok single line: '0'

Test #46:

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

input:

1000 50
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

output:

0

result:

ok single line: '0'