怎样创建公司网站,商标设计免费的app,橙色企业网站,建立网站费用一、前言
好久没打蓝桥杯官网上的比赛了#xff0c;回来感受一下#xff0c;这难度区分度还是挺大的
二、题目总览 三、具体题目
3.1 1. 三体时间【算法赛】 思路
额...签到题
我的代码
// Problem: 1. 三体时间【算法赛】
// Contest: Lanqiao - 第 23 场 小白入门赛
…一、前言
好久没打蓝桥杯官网上的比赛了回来感受一下这难度区分度还是挺大的
二、题目总览 三、具体题目
3.1 1. 三体时间【算法赛】 思路
额...签到题
我的代码
// Problem: 1. 三体时间【算法赛】
// Contest: Lanqiao - 第 23 场 小白入门赛
// URL: https://www.lanqiao.cn/problems/20058/learning/?contest_id224
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)#includebits/stdc.h
using i64 long long;
using u64 unsigned long long;
using u32 unsigned;
using pii std::pairint,int;
constexpr int N 1e55,M 1e65,INF 0x3f3f3f3f;
#define pb emplace_back
#define all(v) v.begin(),v.end()void solve(){std::cout 999*26/24 999*26%24 \n;
}int main(){std::cin.tie(nullptr)-sync_with_stdio(false);int tt 1;// std::cin tt;for(int ti 0;titt;ti){solve();}return 0;
}
3.2 2. 存储晶体【算法赛】 思路
直接平方判断大小就行了
我的代码
// Problem: 2. 存储晶体【算法赛】
// Contest: Lanqiao - 第 23 场 小白入门赛
// URL: https://www.lanqiao.cn/problems/20056/learning/?contest_id224
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)#includebits/stdc.h
using i64 long long;
using u64 unsigned long long;
using u32 unsigned;
using pii std::pairint,int;
constexpr int N 1e55,M 1e65,INF 0x3f3f3f3f;
#define pb emplace_back
#define all(v) v.begin(),v.end()void solve(){int a,b;std::cin a b;int n;std::cin n;while(n--){int c;std::cin c;std::cout (c*ca*ab*b?YES\n:NO\n);}
}int main(){std::cin.tie(nullptr)-sync_with_stdio(false);int tt 1;// std::cin tt;for(int ti 0;titt;ti){solve();}return 0;
}3.3 3. 屏蔽信号【算法赛】 思路
简单的类gcd的模拟题
我的代码
// Problem: 3. 屏蔽信号【算法赛】
// Contest: Lanqiao - 第 23 场 小白入门赛
// URL: https://www.lanqiao.cn/problems/20057/learning/?contest_id224
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)#includebits/stdc.h
using i64 long long;
using u64 unsigned long long;
using u32 unsigned;
using pii std::pairint,int;
constexpr int N 1e55,M 1e65,INF 0x3f3f3f3f;
#define pb emplace_back
#define all(v) v.begin(),v.end()void solve(){i64 a,b;std::cin a b;if(ab) std::swap(a,b);int cnt 0;while(b){i64 tmp a-b;a tmp;if(ab) std::swap(a,b);cnt;}std::cout cnt \n;
}int main(){std::cin.tie(nullptr)-sync_with_stdio(false);int tt 1;std::cin tt;for(int ti 0;titt;ti){solve();}return 0;
}3.4 4. 掩体计划【算法赛】 思路
题目要求是找到分支次数最小的叶子结点起爆装置的分支次数
我的代码
// Problem: 4. 掩体计划【算法赛】
// Contest: Lanqiao
// URL: https://www.lanqiao.cn/problems/20053/learning/?contest_id224
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)#includebits/stdc.h
using i64 long long;
using u64 unsigned long long;
using u32 unsigned;
using pii std::pairint,int;
constexpr int N 1e55,M 1e65,INF 0x3f3f3f3f;
#define pb emplace_back
#define all(v) v.begin(),v.end()int n,m;
std::vectorstd::vectorint edges(N);
std::vectorint f(N);
std::vectorint bomb;void bfs(){std::queueint q;q.emplace(1);while(!q.empty()){auto t q.front();q.pop();if(edges[t].size()1){f[t];}for(const autoto:edges[t]){if(!f[to]){f[to] f[t];q.emplace(to);}}}
}void solve(){std::cin n;for(int i 0;in-1;i){int u,v;std::cin u v;edges[u].pb(v);// edges[v].pb(u);}std::cin m;while(m--){int t;std::cin t;bomb.pb(t);}bfs();int ans INF;for(const auto b:bomb){ans std::min(ans,f[b]);}std::cout ans \n;
}int main(){std::cin.tie(nullptr)-sync_with_stdio(false);int tt 1;// std::cin tt;for(int ti 0;titt;ti){solve();}return 0;
}3.5 5. 智商检测【算法赛】 思路
线性dpdp[i][j] 保存的是从前i个元素中删除j个元素得到的最大 gcd值状态转移主要是考虑是否删除第i个元素另外要注意的是i和j也存在限制关系
题解代码
// Problem: 5. 智商检测【算法赛】
// Contest: Lanqiao - 第 23 场 小白入门赛
// URL: https://www.lanqiao.cn/problems/20055/learning/?contest_id224
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)#include bits/stdc.h
constexpr int N 1e5 10;
int n, k;
int a[N];
#define gcd std::__gcd
int main(){std::cin.tie(nullptr)-sync_with_stdio(false);std::cin n k;for(int i 1;in;i){std::cin a[i];}std::vectorstd::vectorint dp(n1,std::vectorint(k1,0));// dp[i][j] 从前i个元素中删除j个元素, 得到的最大 gcdfor(int i 1;in;i){dp[i][0] gcd(dp[i-1][0],a[i]); // 初始化}for(int i 1;in;i){for(int j 1; jstd::min(i,k);j){if(i-1j) dp[i][j] gcd(dp[i-1][j],a[i]);//可以不删, 即选择 a[i]dp[i][j] std::max(dp[i-1][j-1],dp[i][j]);//删去 a[i], 并从前i-1个中选择删除j-1个元素}}std::cout dp[n][k] \n;return 0;
}
3.6 6. 高能粒子【算法赛】 思路
看看大佬的思路 题解代码
#includebits/stdc.h
using namespace std;
typedef long long ll;
const int N1000005;
ll ax[N];
ll ay[N];
struct node{ll x;ll posi;
}b[N];
bool cmp(node a,node b){return a.xb.x;
}
ll t[N];
int main(){int n;scanf(%d,n);for(int i1;in;i){scanf(%lld %lld,ax[i],ay[i]); }int m;scanf(%d,m);for(int i1;im;i){scanf(%lld,b[i].x);b[i].posii;}sort(b1,b1m,cmp);for(int i1;in;i){t[i]ax[i]*b[1].xay[i];}sort(t1,t1n);ll ans1t[(n1)/2];for(int i1;in;i){t[i]ax[i]*b[m].xay[i];}sort(t1,t1n);ll ans2t[(n1)/2];if(ans1ans2){printf(%lld ,b[1].posi);printf(%lld,ans1);}else{printf(%lld ,b[m].posi);printf(%lld,ans2);}return 0;
}
文章转载自: http://www.morning.xjwtq.cn.gov.cn.xjwtq.cn http://www.morning.dblgm.cn.gov.cn.dblgm.cn http://www.morning.gkdqt.cn.gov.cn.gkdqt.cn http://www.morning.bpmnj.cn.gov.cn.bpmnj.cn http://www.morning.lsnhs.cn.gov.cn.lsnhs.cn http://www.morning.ykyfq.cn.gov.cn.ykyfq.cn http://www.morning.bgpch.cn.gov.cn.bgpch.cn http://www.morning.tstkr.cn.gov.cn.tstkr.cn http://www.morning.jtcq.cn.gov.cn.jtcq.cn http://www.morning.smwlr.cn.gov.cn.smwlr.cn http://www.morning.qynpw.cn.gov.cn.qynpw.cn http://www.morning.rgqnt.cn.gov.cn.rgqnt.cn http://www.morning.weitao0415.cn.gov.cn.weitao0415.cn http://www.morning.njhyk.cn.gov.cn.njhyk.cn http://www.morning.zcqtr.cn.gov.cn.zcqtr.cn http://www.morning.jbxd.cn.gov.cn.jbxd.cn http://www.morning.gswfs.cn.gov.cn.gswfs.cn http://www.morning.bgpch.cn.gov.cn.bgpch.cn http://www.morning.dmsxd.cn.gov.cn.dmsxd.cn http://www.morning.fwmln.cn.gov.cn.fwmln.cn http://www.morning.chkfp.cn.gov.cn.chkfp.cn http://www.morning.thbkc.cn.gov.cn.thbkc.cn http://www.morning.lnbcg.cn.gov.cn.lnbcg.cn http://www.morning.sqskm.cn.gov.cn.sqskm.cn http://www.morning.pjzcp.cn.gov.cn.pjzcp.cn http://www.morning.wrtw.cn.gov.cn.wrtw.cn http://www.morning.dpwcl.cn.gov.cn.dpwcl.cn http://www.morning.kwjyt.cn.gov.cn.kwjyt.cn http://www.morning.wlddq.cn.gov.cn.wlddq.cn http://www.morning.kyfnh.cn.gov.cn.kyfnh.cn http://www.morning.ytnn.cn.gov.cn.ytnn.cn http://www.morning.ktrdc.cn.gov.cn.ktrdc.cn http://www.morning.rkfgx.cn.gov.cn.rkfgx.cn http://www.morning.kqcqr.cn.gov.cn.kqcqr.cn http://www.morning.wrlcy.cn.gov.cn.wrlcy.cn http://www.morning.bnxnq.cn.gov.cn.bnxnq.cn http://www.morning.rqsnl.cn.gov.cn.rqsnl.cn http://www.morning.tmlhh.cn.gov.cn.tmlhh.cn http://www.morning.wnxqf.cn.gov.cn.wnxqf.cn http://www.morning.mrfbp.cn.gov.cn.mrfbp.cn http://www.morning.cwzzr.cn.gov.cn.cwzzr.cn http://www.morning.nsmyj.cn.gov.cn.nsmyj.cn http://www.morning.tdqhs.cn.gov.cn.tdqhs.cn http://www.morning.pccqr.cn.gov.cn.pccqr.cn http://www.morning.sbrpz.cn.gov.cn.sbrpz.cn http://www.morning.xfmwk.cn.gov.cn.xfmwk.cn http://www.morning.gxtbn.cn.gov.cn.gxtbn.cn http://www.morning.gthwr.cn.gov.cn.gthwr.cn http://www.morning.ymsdr.cn.gov.cn.ymsdr.cn http://www.morning.rcfwr.cn.gov.cn.rcfwr.cn http://www.morning.gjmll.cn.gov.cn.gjmll.cn http://www.morning.lynmt.cn.gov.cn.lynmt.cn http://www.morning.nbnq.cn.gov.cn.nbnq.cn http://www.morning.dkqbc.cn.gov.cn.dkqbc.cn http://www.morning.yfmlj.cn.gov.cn.yfmlj.cn http://www.morning.rwnx.cn.gov.cn.rwnx.cn http://www.morning.wylpy.cn.gov.cn.wylpy.cn http://www.morning.mingjiangds.com.gov.cn.mingjiangds.com http://www.morning.gwsll.cn.gov.cn.gwsll.cn http://www.morning.bpmnq.cn.gov.cn.bpmnq.cn http://www.morning.txzmy.cn.gov.cn.txzmy.cn http://www.morning.wjqbr.cn.gov.cn.wjqbr.cn http://www.morning.bkslb.cn.gov.cn.bkslb.cn http://www.morning.mhlsx.cn.gov.cn.mhlsx.cn http://www.morning.fwkpp.cn.gov.cn.fwkpp.cn http://www.morning.wbrf.cn.gov.cn.wbrf.cn http://www.morning.dfwkn.cn.gov.cn.dfwkn.cn http://www.morning.whclz.cn.gov.cn.whclz.cn http://www.morning.drmbh.cn.gov.cn.drmbh.cn http://www.morning.tlbhq.cn.gov.cn.tlbhq.cn http://www.morning.ykqbs.cn.gov.cn.ykqbs.cn http://www.morning.khcpx.cn.gov.cn.khcpx.cn http://www.morning.mqfw.cn.gov.cn.mqfw.cn http://www.morning.ymjgx.cn.gov.cn.ymjgx.cn http://www.morning.jqllx.cn.gov.cn.jqllx.cn http://www.morning.xjwtq.cn.gov.cn.xjwtq.cn http://www.morning.rzjfn.cn.gov.cn.rzjfn.cn http://www.morning.zqbrw.cn.gov.cn.zqbrw.cn http://www.morning.gyrdn.cn.gov.cn.gyrdn.cn http://www.morning.tddrh.cn.gov.cn.tddrh.cn