当前位置:网站首页>"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
边栏推荐
- Modification of system module information of PHP security development 12 blog system
- Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
- PCA from 0 to 1
- Data system provider Jidao technology joins dragon lizard community
- Redis cluster + sentinel mode + replicas
- Annotate your own point cloud dataset with labelcloud open source tool as a tutorial of Kitti annotation format (support PCD and bin point clouds)
- Various error reporting solutions encountered by Kali during Empire installation
- [C language] summary of basic knowledge points of pointer
- [从零开始学习FPGA编程-19]:快速入门篇 - 操作步骤4-1- Verilog 软件下载与开发环境的搭建- Altera Quartus II版本
- 如何定位关键词使得广告精准投放。
猜你喜欢

螺旋矩阵(技巧)

Point cloud perception algorithm interview knowledge points (II)

PyGame alien invasion

Spiral matrix (skill)

联调这夜,我把同事打了...

MySQL实训报告【带源码】

In 2022, the internal promotion of the "MIHA Tour" golden, silver and silver social recruitment started in April and march! Less overtime, good welfare, 200+ posts for you to choose, come and see!

MySQL表常用操作思维导图

Linux(CentOS6)安装MySQL5.5版本数据库

Ce soir - là, j'ai battu mon collègue...
随机推荐
Linux (centos7) installer mysql - 5.7
Ce soir - là, j'ai battu mon collègue...
PHP builds a high-performance API architecture based on sw-x framework (III)
LeetCode Algorithm 1791. Find the central node of the star chart
Comprehensive quality of teaching resources in the second half of 2019 - subjective questions
大一下期:学习总结
[从零开始学习FPGA编程-20]:快速入门篇 - 操作步骤4-2-Altera Quartus II工具的快速使用(modelSim联合仿真、程序下载到Altera开发板)
MP3 to Wav to Midi
华为,这也太强了吧..
Lua function
LeetCode Algorithm 997. 找到小镇的法官
Pytorch model loading and saving, and training based on the saved model
Agile v.s. Waterfall
Leetcode 1005 maximized array sum after K negations
php安全开发 13博客系统的栏目模块的编写
【科普视频】到底什么是透镜天线?
UoE UG2 Inf Course Research
Software engineering - system flow chart
Applets 111111
Manually tear the linked list (insert, delete, sort) and pointer operation