This commit is contained in:
2025-09-15 21:12:04 +08:00
commit 3f58f483ff
144 changed files with 5298 additions and 0 deletions

36
24/11/3258.cpp Normal file
View File

@@ -0,0 +1,36 @@
#include <string>
#include <iostream>
using namespace std;
int countKConstraintSubstrings(string s, int k)
{
int a, b;
int count = 0;
for (int i = 1; i <= s.length(); i++)
{
int j = 0;
while (j + i <= s.length())
{
a = 0;
b = 0;
for (int k = j; k < j + i; k++)
{
if (s[k] == '0')
{
a++;
}
else
{
b++;
}
}
if (a <= k || b <= k)
{
count++;
cout << j << " " << j + i << " " << a << " " << b << endl;
}
j++;
}
}
return count;
}