This commit is contained in:
Zengtudor 2024-12-07 23:08:02 +08:00
parent 0401e39821
commit bf213d134c
6 changed files with 168 additions and 2 deletions

View File

@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 3.10)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-Wall) add_compile_options(-Wall)
set(CMAKE_CXX_STANDARD 26) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-fexperimental-new-constant-interpreter) # add_compile_options(-fexperimental-new-constant-interpreter)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
endif() endif()

44
src/12/7/sh1000.cpp Normal file
View File

@ -0,0 +1,44 @@
#include <algorithm>
#include <cstdint>
#include <iostream>
using ll = int64_t;
ll t,n;
int main(){
std::cin>>t;
while(t--){
std::cin>>n;
ll bobAns{}, bellaAns{}, bobNow{}, bellaNow{};
for(ll i{1};i<=n;i++){
ll tmp;
std::cin>>tmp;
if(tmp>0){
bobNow++;
}else{
bobAns=std::max(bobAns,bobNow);
bobNow=0;
}
}
bobAns=std::max(bobAns,bobNow);
for(ll i{1};i<=n;i++){
ll tmp;
std::cin>>tmp;
if(tmp>0){
bellaNow++;
}else{
bellaAns=std::max(bellaAns,bellaNow);
bellaNow=0;
}
}
bellaAns=std::max(bellaAns,bellaNow);
if(bobAns>bellaAns){
std::cout<<"Bob\n";
}else if(bellaAns>bobAns){
std::cout<<"Bella\n";
}else{
std::cout<<"Draw\n";
}
}
}

35
src/12/7/sh1001.cpp Normal file
View File

@ -0,0 +1,35 @@
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>
using ll = int64_t;
bool greater(ll const& a,ll const& b)noexcept{
return a>b;
}
int main(){
ll t;
std::cin>>t;
while(t--){
ll n,m,h;
std::cin>>n>>m>>h;
const ll maxn{ll(1e5+5)};
static std::vector<ll> bty(maxn);
for(ll i{1};i<=n;i++){
std::cin>>bty[i];
}
static std::vector<ll> pw(maxn);
for(ll i{1};i<=m;i++){
std::cin>>pw[i];
}
std::sort(bty.data()+1,bty.data()+1+n,greater);
std::sort(pw.data()+1,pw.data()+1+m,greater);
const ll minNm{std::min(n,m)};
ll ans{};
for(ll i{1};i<=minNm;i++){
ans+=(h*pw[i]>bty[i]?bty[i]:h*pw[i]);
}
std::cout<<ans<<'\n';
}
}

33
src/12/7/sh1002.cpp Normal file
View File

@ -0,0 +1,33 @@
#include <cstddef>
#include <cstdint>
#include <ios>
#include <iostream>
using ll = int64_t;
int main(){
std::ios::sync_with_stdio(false),std::cin.tie(nullptr),std::cout.tie(nullptr);
ll t;
std::cin>>t;
while(t--){
static ll n,m;
std::cin>>n>>m;
const ll maxn{size_t(5e5+5)};
static ll a[maxn];
for(ll i{1};i<=n;i++){
std::cin>>a[i];
}
for(ll i{1};i<=n;i++){
ll msk{a[i]};
for(ll j{i};j<=n;j++){
msk&=a[j];
if(msk==m){
std::cout<<"Yes\n";
goto outLoop;
}
}
}
std::cout<<"No\n";
outLoop:;
}
}

40
src/12/7/sh1003.cpp Normal file
View File

@ -0,0 +1,40 @@
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
while(T--){
int n;
cin >> n;
string S;
cin >> S;
ll c0=1, c1=0, c2=0, c3=0;
for(int i=0;i<n;i++){
char c = S[i];
if(c == '4'){
c1 = (c1 + c0) % MOD;
c3 = (c3 + c2) % MOD;
}
else if(c == '0'){
c2 = (c2 + c1) % MOD;
}
else if(c == '*'){
ll temp_c1 = (2*c1 + c0) % MOD;
ll temp_c2 = (2*c2 + c1) % MOD;
ll temp_c3 = (2*c3 + c2) % MOD;
c1 = temp_c1;
c2 = temp_c2;
c3 = temp_c3;
c0 = (2*c0) % MOD;
}
}
cout << c3 << "\n";
}
}

14
src/12/7/sh984.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <cstdint>
#include <iostream>
using ll = int64_t;
int main(){
int n;
std::cin>>n;
if(6<=n&&n<=8){
std::cout<<"Yes\n";
}else{
std::cout<<"No\n";
}
}