This commit is contained in:
Zengtudor 2024-08-08 14:12:15 +08:00
parent 1196f9d2a1
commit a03cea7984
5 changed files with 62 additions and 4 deletions

28
day5/perfect/fix.cpp Normal file
View File

@ -0,0 +1,28 @@
#include<bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5+5;
const int MAX_K = 19;
int sMin[MAX_N][MAX_K];
int sMax[MAX_N][MAX_K];
int l[MAX_N];
int main(){
cin.sync_with_stdio(false);
cin.tie(0);
l[1]=0;
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>sMin[i][0];
sMax[i][0]=sMin[i][0];
if(i!=1)l[i]=l[(i>>1)]+1;
}
int k=l[n]+1;
for(int j=1;j<=k;j++){
for(int i=1;i+(1<<j)-1<=n;i++){
sMax[i][j]=max(sMax[i][j-1],sMax[i+(1<<(j-1))][j-1]);
}
}
}

BIN
day6/CSP-S1 模拟赛.pdf Normal file

Binary file not shown.

View File

@ -27,9 +27,7 @@ signed main(){
#endif
#ifdef ISTEST
#define assertr(e){if(!(e)){cerr<<"error on "<<#e<<" :"<<"False"<<endl;return -1;}else{cout<<#e<<" Passed OK!";}}
int main(){
assertr(binExp(2, 10, 9)==7);
assert(binExp(2, 10, 9)==7);
}
#endif

23
day6/pre88/pre88.cpp Normal file
View File

@ -0,0 +1,23 @@
#include<bits/stdc++.h>
using namespace std;
string s1,s2,s3,s4,s5,s6;
/*
1.B 2.B
*/
int main() {
s1 = "ABCDABCDABCDABC";
s2 = "TFTFAB";
s3 = "TFTABC";
s4 = "TFTABC";
s5 = "ABCDA";
s6 = "ABCDA";
string ans = s1 + s2 + s3 + s4 + s5 + s6;
assert(ans.length() == 43);
cout<<ans;
return 0;
}

View File

@ -23,4 +23,13 @@ target("P3865")
target("binExp")
set_kind("binary")
add_files("./day6/binaryExponentiation/*.cpp")
add_tests("binExp",{files="./day6/binaryExponentiation/*.cpp",defines = "ISTEST"})
add_tests("binExp",{files="./day6/binaryExponentiation/*.cpp",defines = "ISTEST"})
target("fperfect")
set_kind("binary")
add_files("./day5/perfect/fix.cpp")
add_tests("fperfect",{files="././day5/perfect/fix.cpp",defines="OITEST"})
target("pre88")
set_kind("binary")
add_files("./day6/pre88/*.cpp")