当前位置:网站首页>"China Dongxin Cup" the fourth programming competition of Guangxi University (synchronous competition)
"China Dongxin Cup" the fourth programming competition of Guangxi University (synchronous competition)
2022-06-12 01:49:00 【Rong AI holiday】
“ China Dongxin Cup ” The fourth programming competition of Guangxi University ( Synchronized competition )
List of articles
Topic knowledge
- simulation
- gcd and lcm
- thinking
- Completely backpack
- kmp
- Monotonic stack
Title code
A Antinomy And the gold content of the game
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
const ll maxn=1e5+10;
ll t;
int main(){
cin>>t;
while(t--){
ll x,y,z;
cin>>x>>y>>z;
if(x>90&&y>90&&z>60){
cout<<"A+\n";
}else{
cout<<"E+\n";
}
}
return 0;
}
B Antinomy And take the mold
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
const ll maxn=1e5+10;
ll t;
ll gcd(ll a,ll b){
return b ? gcd(b,a%b) : a;
}
int main(){
scanf("%lld",&t);
while(t--){
ll x,y,l,r;
scanf("%lld%lld%lld%lld",&x,&y,&l,&r);
ll val=gcd(x,y);
val=x*y/val;
ll q=l/val;
ll p=r/val;
ll flag=0;
for(int i=q;i<=p;i++){
//cout<<i*val<<endl;
if((i*val)>=l&&(i*val)<=r){
printf("%lld\n",i*val);
flag=1;
break;
}
}
if(!flag){
printf("-1\n");
}
}
return 0;
}
C Antinomy And clean up magic
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
const ll maxn=1e5+10;
ll n,k;
ll a[maxn];
int main(){
scanf("%lld%lld",&n,&k);
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
}
sort(a+1,a+1+n);
ll flag=0;
for(int i=2;i<=n;i++){
if((a[i]-a[i-1])>k){
flag=1;
break;
}
}
if(flag){
printf("NO");
}else{
printf("YES");
}
return 0;
}
E Antinomy Slow down the skill tree
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
const ll maxn=1e5+10;
ll n,k;
ll w[maxn];
ll v[maxn];
ll f[maxn];
int main(){
scanf("%lld",&n);
for(int i=1;i<=n;i++){
double v1;
scanf("%lf %lld",&v1,&w[i]);
v1=(v1+0.00005)*10000;
v[i]=v1;
//cout<<v[i]<<" ";
}
ll ans=0;
for(int i=1;i<=n;i++){
for(int j=10000;j>=v[i];j--){
f[j]=max(f[j],f[j-v[i]]+w[i]);
ans=max(f[j],ans);
//cout<<f[j]<<" ";
}
//cout<<endl;
}
printf("%lld\n",ans);
return 0;
}
/*
4
1 5
0.4999 7
0.5001 3
0.9 12
0.1001 15
*/
F Antinomy With the golden finger
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
const ll maxn=5e5+10;
ll n;
string s,t;
ll nex[maxn];
void getnex(){
ll k=-1;
ll j=0;
nex[0]=-1;
ll len=s.size();
while(j<len){
if(k==-1||s[j]==s[k]){
j++;
k++;
nex[j]=k;
}else{
k=nex[k];
}
}
}
ll kmp(){
ll len1=s.size(),len2=t.size();
if(len1>len2){
return 0;
}
ll i=0,j=0;
while(i<len2){
if(j==-1||t[i]==s[j]){
i++;
j++;
}else{
j=nex[j];
}
if(j==len1){
return 1;
}
}
return 0;
}
int main(){
cin>>n;
cin>>t>>s;
t+=t;
getnex();
if(!kmp()){
printf("TAT");
}else{
printf("wow");
}
return 0;
}
H Antinomy And magic power
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
typedef long long int ll;
const ll maxn=2e5+10;
ll st[maxn];
ll l[maxn];
ll r[maxn];
ll a[maxn];
ll ans[maxn];
ll n;
ll now;
int main(){
scanf("%lld",&n);
for(int i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
}
now=-1;
st[++now]=0;
for(int i=1;i<=n;i++){
while(now>=0&&a[i]<=a[st[now]])now--;
l[i]=st[now];
st[++now]=i;
}
now=-1;
st[++now]=n+1;
for(int i=n;i>=1;i--){
while(now>=0&&a[i]<=a[st[now]])now--;
r[i]=st[now];
st[++now]=i;
}
//a[i] stay r[i]-l[i]-1 Length and below are useful
for(int i=1;i<=n;i++){
ans[r[i]-l[i]-1]=max(a[i],ans[r[i]-l[i]-1]);
//cout<<l[i]<<" "<<r[i]<<endl;
}
for(int i=n;i>=1;i--){
ans[i]=max(ans[i],ans[i+1]);
}
for(int i=1;i<=n;i++){
printf("%lld ",ans[i]);
}
return 0;
}
Answer key pdf Download link
Conclusion
- Never decide Ask the spring breeze
- The spring breeze is silent That is, follow your heart
- If my heart can settle How can you not make up your mind when you are in trouble Spring breeze also has spring breeze sorrow Don't worry about me .
- Since then, the spring breeze has filled my sleeves , Just for the sake of peace
边栏推荐
- MP3 to Wav to Midi
- 如何为Excel中的单元格自动填充颜色
- lua 函数
- Concepts of programs, processes, and threads
- Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
- How to automatically color cells in Excel
- Design practice of rongyun Im on electron platform
- 括号生成(回溯)
- The role of MOV ah, 4CH int 21
- Wide match modifier symbol has been deprecated, do not use
猜你喜欢

Why do we use Google search ads?

华为联运游戏或应用审核驳回:应用检测到支付serviceCatalog:X6
![MySQL training report [with source code]](/img/c2/46bdc2f8c522d2c8881e532b6f3f49.png)
MySQL training report [with source code]

kmeans从0到1

Concepts of programs, processes, and threads

MySQL实训报告【带源码】

"It's safer to learn a skill!" The little brother of Hangzhou campus changes to software testing, and likes to mention 10k+ weekend!

PCA from 0 to 1

西南林业大学“西林链”通过工信部电子标准院功能测试 | FISCO BCOS案例

Sogou Pinyin official website screenshot tool pycharm installation
随机推荐
Pagination writing of PHP security open 10 article list module
Various error reporting solutions encountered by Kali during Empire installation
Redis集群更换节点IP后如何恢复集群并保留完整集群数据
Pytorch model loading and saving, and training based on the saved model
“还是学一门技术更保险!”杭州校区小哥哥转行软件测试,喜提10K+双休!
初探性能优化!从2个月到4小时的性能提升!
Basic use of MATLAB
Linux(CentOS7)安装MySQL-5.7版本
[learn FPGA programming from scratch -20]: quick start chapter - operation steps 4-2-quick use of Altera quartz II tool (Modelsim co simulation, program download to altera development board)
Data system provider Jidao technology joins dragon lizard community
LeetCode LCP 07. 传递信息
Perceptron from 0 to 1
Huawei, this is too strong
Is the bidding price fixed for each click?
Machines / scenarios not suitable for webrdp
Tiobe - programming language ranking in June 2022
LeetCode Algorithm 1791. 找出星型图的中心节点
Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
Entity class dto to VO is converted through plug-in
The resignation of the chief oracle engineer was furious: MySQL is a terrible database, so it is recommended to consider PostgreSQL!