mirror of
https://gitcode.com/Zengtudor/alg2025.git
synced 2025-11-07 07:13:48 +00:00
fix(test.cpp): 修正source_location的使用方式
feat(P7114.cpp): 添加字符串处理算法实现
This commit is contained in:
parent
abf764a938
commit
e78435a306
53
src/11/6/P7114.cpp
Normal file
53
src/11/6/P7114.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#include <bitset>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iostream>
|
||||||
|
#include <istream>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
using ll = int64_t;
|
||||||
|
#define sl static inline
|
||||||
|
|
||||||
|
std::string s;
|
||||||
|
std::bitset<256> mcj,maj;
|
||||||
|
sl ll cj(){return mcj.count();}
|
||||||
|
sl ll aj(){return maj.count();}
|
||||||
|
|
||||||
|
sl void solve(){
|
||||||
|
ll ans=0;
|
||||||
|
mcj.reset();
|
||||||
|
maj.reset();
|
||||||
|
std::cin>>s;
|
||||||
|
for(ll alen=1;alen<s.size()-1;alen++){
|
||||||
|
maj[s[alen-1]]=maj[s[alen-1]]^1;
|
||||||
|
for(ll blen=1;alen+blen<s.size();blen++){
|
||||||
|
mcj.reset();
|
||||||
|
for(ll l=1;l*(alen+blen)<s.size();l++){
|
||||||
|
for(ll ci=l*(alen+blen);ci<s.size();ci++){
|
||||||
|
mcj[s[ci]]=mcj[s[ci]]^1;
|
||||||
|
}
|
||||||
|
if(aj()>cj()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for(ll i=alen+blen;i<l*(alen+blen);i++){
|
||||||
|
if(s[i%(alen+blen)]!=s[i]){
|
||||||
|
goto nxt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ans++;
|
||||||
|
nxt:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout<<ans<<"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
std::iostream::sync_with_stdio(false);
|
||||||
|
std::cin.tie(nullptr);
|
||||||
|
|
||||||
|
ll t;
|
||||||
|
std::cin>>t;
|
||||||
|
while(t--){
|
||||||
|
solve();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,5 +2,5 @@
|
|||||||
#include <print>
|
#include <print>
|
||||||
#include <source_location>
|
#include <source_location>
|
||||||
int main(){
|
int main(){
|
||||||
std::println("hello world from {}\n",std::source_location().file_name());
|
std::println("hello world from {}\n",std::source_location::current().file_name());
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user