QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499446#6726. Turn It OffzmrzmrWA 22ms3756kbC++17600b2024-07-31 14:19:542024-07-31 14:19:54

Judging History

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

  • [2024-07-31 14:19:54]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:3756kb
  • [2024-07-31 14:19:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+10;
string s;
int flag1,flag2;
void solve()
{
	int x,y;
	cin>>x>>y;
	cin>>s;
	for(int i = 0; i < x; i++ )
	{
		if(s[i]=='1')
		{
			flag1 = i ;
			break;
		}
	}
	for(int i = x-1; i >= 0; i-- )
	{
		if(s[i]=='1')
		{
			flag2 = i ;
			break;
		}
	}
	if(flag1==flag2)
	{
		cout<<1<<endl;
		return ;
	}
//	cout<<flag2<<" "<<flag1<<" ";
	int ans = flag2-flag1+1;
	ans = ceil(ans*1.0 / y*1.0);
	cout<<ans<<endl;
}
int main()
{
	int tcase;
	cin>>tcase;
	while(tcase--)
	{
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
10 4
0101011111
3 1
010

output:

3
1

result:

ok 2 number(s): "3 1"

Test #2:

score: -100
Wrong Answer
time: 22ms
memory: 3756kb

input:

1109
47 36
11101110101001111110101101100001000011101001011
6 5
100010
35 26
00011111000000101010011010100101111
71 45
11101001000111011101101000000000010001100100110000001000011011001011000
32 23
00000100011110010101000110010110
36 30
110110000000000011010001100011111100
21 8
010000011010011101100
9...

output:

2
1
2
2
2
2
3
6
10
3
3
4
4
2
2
2
2
2
2
3
2
2
7
7
2
2
2
1
2
2
2
3
2
2
3
4
2
1
4
2
2
7
2
2
5
2
1
4
11
19
2
2
2
5
2
2
3
2
3
2
2
2
1
2
60
17
3
4
3
3
2
2
4
2
2
2
1
2
3
3
2
4
5
3
2
2
5
4
2
2
4
2
2
2
2
2
5
3
4
2
3
1
2
2
2
3
2
2
3
1
1
81
2
5
2
2
1
2
2
44
2
5
3
3
2
1
2
3
2
9
1
2
4
2
2
3
2
46
2
1
2
3
1
2
2
2
...

result:

wrong answer 1st numbers differ - expected: '1', found: '2'