当前位置: 首页 > news >正文

建设行业个人云网站高端网站建设公司

建设行业个人云网站,高端网站建设公司,抖音小程序开发一个多少钱,网页制作设计模板个人主页:GUIQU. 归属专栏:每日一题 文章目录 1. 【2.3】P8784 [蓝桥杯 2022 省 B] 积木画2. 【2.4】P8656 [蓝桥杯 2017 国 B] 对局匹配3. 【2.5】[ABC365D] AtCoder Janken 34. 【2.6】P8703 [蓝桥杯 2019 国 B] 最优包含5. 【2.7】P8624 [蓝桥杯 2015…

在这里插入图片描述

个人主页:GUIQU.
归属专栏:每日一题

在这里插入图片描述

文章目录

  • 1. 【2.3】P8784 [蓝桥杯 2022 省 B] 积木画
  • 2. 【2.4】P8656 [蓝桥杯 2017 国 B] 对局匹配
  • 3. 【2.5】[ABC365D] AtCoder Janken 3
  • 4. 【2.6】P8703 [蓝桥杯 2019 国 B] 最优包含
  • 5. 【2.7】P8624 [蓝桥杯 2015 省 AB] 垒骰子
  • 6. 【2.8】P8774 [蓝桥杯 2022 省 A] 爬树的甲壳虫
  • 7. 【2.9】[ARC189C] Balls and Boxes

正文

1. 【2.3】P8784 [蓝桥杯 2022 省 B] 积木画

题目链接:https://www.luogu.com.cn/problem/P8784

【AC_Code】

#include <iostream>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;const int mod = 1e9 + 7;
int N;int main()
{IOS; cin >> N;if (N == 1){cout << 1 << "\n";return 0;}if (N == 2){cout << 2 << "\n";return 0;}if (N == 3){cout << 5 << "\n";return 0;}int a = 1, b = 2, c = 5, d;for (int i = 4; i <= N; i ++){d = c * 2 % mod + a;a = b, b = c, c = d;a %= mod, b %= mod, c %= mod, d %= mod;}cout << d << "\n";return 0;
}

2. 【2.4】P8656 [蓝桥杯 2017 国 B] 对局匹配

题目链接:https://www.luogu.com.cn/problem/P8656

【AC_Code】

#include <iostream>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;const int maxN = 1e5 + 10;
int N, K, index, ans, a[maxN];int main()
{IOS; cin >> N >> K;for (int i = 0; i < N; i ++) cin >> index, a[index] ++;if (K == 0){for (int i = 0; i < N; i ++) if (a[i]) ans ++;cout << ans << "\n";return 0;}for (int i = 0; i < maxN; i ++){if (a[i] < a[i + K]) a[i + K] -= a[i];else a[i + K] = 0;}for (int i = 0; i < maxN - K; i ++) ans += a[i];cout << ans << "\n";return 0;
}

3. 【2.5】[ABC365D] AtCoder Janken 3

题目链接:https://www.luogu.com.cn/problem/AT_abc365_d

【AC_Code】

#include <bits/stdc++.h>
#define int long longusing namespace std;const int N = 2e5 + 10;
int n, ans, f[N][10];
string s;int main()
{cin >> n >> s;if (s[0] == 'R') {f[0][1] = 0;f[0][2] = 1;}if (s[0] == 'P') {f[0][2] = 0;f[0][3] = 1;}if (s[0] == 'S') {f[0][1] = 1;f[0][3] = 0;}for (int i = 1; i < n; i++) {if (s[i] == 'R') {f[i][1] = max(f[i - 1][2], f[i - 1][3]);f[i][2] = max(f[i - 1][1], f[i - 1][3]) + 1;}if (s[i] == 'P') {f[i][2] = max(f[i - 1][1], f[i - 1][3]);f[i][3] = max(f[i - 1][1], f[i - 1][2]) + 1;}if (s[i] == 'S') {f[i][1] = max(f[i - 1][2], f[i - 1][3]) + 1;f[i][3] = max(f[i - 1][1], f[i - 1][2]);}}cout << max({f[n - 1][1], f[n - 1][2], f[n - 1][3]});return 0;
}

4. 【2.6】P8703 [蓝桥杯 2019 国 B] 最优包含

题目链接:https://www.luogu.com.cn/problem/P8703

【AC_Code】

#include <iostream>
#include <cstring>
#include <algorithm>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define inf 0x3f3f3f3fusing namespace std;const int maxn = 1010;
int dp[maxn][maxn];
string S, T;int main()
{IOS; cin >> S >> T; S = " " + S, T = " " + T;memset(dp, inf, sizeof(dp));for (int i = 0; i < S.size() + 1; i ++) dp[i][0] = 0;for (int i = 1; i <= S.size(); i ++) for (int j = 1; j <= S.size(); j ++){if (S[i] == T[j]) dp[i][j] = dp[i-1][j-1];else dp[i][j] = min(dp[i-1][j-1]+1, dp[i-1][j]);}cout << dp[S.size()][T.size()] << "\n";return 0;
}

5. 【2.7】P8624 [蓝桥杯 2015 省 AB] 垒骰子

题目链接:https://www.luogu.com.cn/problem/P8624

【AC_Code】

#include<bits/stdc++.h>
using namespace std;
#define rep(x,y,z) for(int x=y;x<=z;x++)
typedef long long LL;
const int mod=1e9+7;
int n,m,a,b,oppo[7]={0,4,5,6,1,2,3};
bool st[7][7];
struct matrix{LL c[7][7];matrix(){memset(c,0,sizeof c);}
}A,res;
matrix operator * (matrix &x,matrix &y){matrix t;rep(i,1,6){rep(j,1,6){rep(k,1,6){t.c[i][j]=(t.c[i][j]+x.c[i][k]*y.c[k][j])%mod;}}}return t;
}
void fastpow(LL k){rep(i,1,6) res.c[1][i]=4;rep(i,1,6){rep(j,1,6){if(st[i][oppo[j]]) A.c[i][j]=0;else A.c[i][j]=4;}}while(k){if(k&1) res=res*A;A=A*A;k>>=1;}
}int main()
{cin>>n>>m;while(m--){cin>>a>>b;st[a][b]=st[b][a]=1;}fastpow(n-1);LL ans=0;rep(i,1,6) ans=(ans%mod+res.c[1][i]%mod)%mod;cout<<ans;return 0;
}

6. 【2.8】P8774 [蓝桥杯 2022 省 A] 爬树的甲壳虫

题目链接:https://www.luogu.com.cn/problem/P8774

【AC_Code】

#include <bits/stdc++.h>using namespace std;const int N = 1e5 + 5;
const int P = 998244353;int n, a[N], b[N];int fp(int x, int y) {int res = 1;for (; y; y >>= 1) {if (y & 1) {res = (1ll * res * x) % P;}x = (1ll * x * x) % P;}return res;
}int main() {scanf("%d", &n);for (int i = 1; i <= n; i++) {scanf("%d%d", &a[i], &b[i]);}int s1 = 1, s2 = 0, s3 = 0;for (int i = 1; i <= n; i++) {int p1 = (1ll * a[i] * fp(b[i], P - 2)) % P;int p2 = (1ll * (b[i] - a[i]) * fp(b[i], P - 2)) % P;s3 = (s3 + s1) % P;s2 = (s2 + 1ll * s1 * p1) % P;s1 = (1ll * s1 * p2) % P;}printf("%d", (1ll * s3 * fp(1 - s2 + P, P - 2)) % P);return 0;
}

7. 【2.9】[ARC189C] Balls and Boxes

题目链接:https://www.luogu.com.cn/problem/AT_arc189_c

【AC_Code】

#include <bits/stdc++.h>#define F(i, a, b) for (int i = (a); i <= (b); ++i)
#define dF(i, a, b) for (int i = (a); i >= (b); --i)using namespace std;typedef long long LL;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pii;const int N = 2e5 + 5;int n, x, a[N], b[N], p[N], q[N];
int m, k, s[N], t[N], tt[N];
bool vis[N];int dp[N], c[N], ans;void Update(int x, int k) {while (x <= n) {c[x] = max(c[x], k);x += x & -x;}
}void Query(int &y, int x) {while (x) {y = max(y, c[x]);x -= x & -x;}
}int main()
{ios::sync_with_stdio(0);cin.tie(0), cout.tie(0);cin >> n >> x;F(i, 1, n) {cin >> a[i];}F(i, 1, n) {cin >> b[i];}F(i, 1, n) {cin >> p[i];}F(i, 1, n) {cin >> q[i];}int u = p[x];bool now = 0;vis[x] = 1;while (!vis[u]) {now |= a[u];vis[u] = 1;if (now) {s[++m] = u;}u = p[u];}F(i, 1, n) {if (!vis[i] && a[i]) {return cout << "-1", 0;}}F(i, 1, n) {vis[i] = 0;}u = q[x];now = 0;vis[x] = 1;while (!vis[u]) {now |= b[u];vis[u] = 1;if (now) {t[++k] = u;}u = q[u];}F(i, 1, n) {if (!vis[i] && b[i]) {return cout << "-1", 0;}}F(i, 1, k) {tt[t[i]] = i;}F(i, 1, m) {if (tt[s[i]]) {Query(dp[i], tt[s[i]]);Update(tt[s[i]], ++dp[i]);}}F(i, 1, n) {ans = max(ans, dp[i]);}cout << m + k - ans;return 0;
}

结语
感谢您的阅读!期待您的一键三连!欢迎指正!

在这里插入图片描述


文章转载自:
http://polyphemus.c7630.cn
http://forestland.c7630.cn
http://dihydrostreptomycin.c7630.cn
http://rakee.c7630.cn
http://miller.c7630.cn
http://gdi.c7630.cn
http://nanoprogram.c7630.cn
http://cozen.c7630.cn
http://porphyritic.c7630.cn
http://thoracic.c7630.cn
http://fret.c7630.cn
http://circulating.c7630.cn
http://penniform.c7630.cn
http://corkily.c7630.cn
http://heptasyllable.c7630.cn
http://clatterer.c7630.cn
http://arrow.c7630.cn
http://undercart.c7630.cn
http://untogether.c7630.cn
http://eucaine.c7630.cn
http://semioval.c7630.cn
http://cultrate.c7630.cn
http://tailwagging.c7630.cn
http://nauseating.c7630.cn
http://unshelled.c7630.cn
http://embolismic.c7630.cn
http://groupuscule.c7630.cn
http://streetlamp.c7630.cn
http://geodynamic.c7630.cn
http://preprimer.c7630.cn
http://bernardine.c7630.cn
http://fazenda.c7630.cn
http://entreatingly.c7630.cn
http://triptych.c7630.cn
http://illiteracy.c7630.cn
http://distract.c7630.cn
http://finnicky.c7630.cn
http://fizzle.c7630.cn
http://barbiturate.c7630.cn
http://absorptive.c7630.cn
http://inattention.c7630.cn
http://elocnte.c7630.cn
http://granita.c7630.cn
http://alliterative.c7630.cn
http://modeling.c7630.cn
http://immolator.c7630.cn
http://marmap.c7630.cn
http://gowan.c7630.cn
http://mobdom.c7630.cn
http://unleased.c7630.cn
http://necessity.c7630.cn
http://photoreaction.c7630.cn
http://occidental.c7630.cn
http://siva.c7630.cn
http://vakky.c7630.cn
http://fallibility.c7630.cn
http://inviolability.c7630.cn
http://saturn.c7630.cn
http://darhan.c7630.cn
http://lps.c7630.cn
http://unanimous.c7630.cn
http://nucellus.c7630.cn
http://volumetric.c7630.cn
http://trivalence.c7630.cn
http://archaeological.c7630.cn
http://tindal.c7630.cn
http://yapese.c7630.cn
http://miniscule.c7630.cn
http://idlesse.c7630.cn
http://uh.c7630.cn
http://cuspidal.c7630.cn
http://smithereen.c7630.cn
http://dawn.c7630.cn
http://again.c7630.cn
http://exoatmosphere.c7630.cn
http://bagman.c7630.cn
http://seabed.c7630.cn
http://ygdrasil.c7630.cn
http://signifiable.c7630.cn
http://morula.c7630.cn
http://tropaeolum.c7630.cn
http://towerless.c7630.cn
http://knockabout.c7630.cn
http://inbeing.c7630.cn
http://woesome.c7630.cn
http://mislabel.c7630.cn
http://superscription.c7630.cn
http://arpanet.c7630.cn
http://ferrochromium.c7630.cn
http://plumbic.c7630.cn
http://rigmarolish.c7630.cn
http://unfished.c7630.cn
http://vina.c7630.cn
http://winey.c7630.cn
http://beslobber.c7630.cn
http://damaged.c7630.cn
http://claymore.c7630.cn
http://owler.c7630.cn
http://coaly.c7630.cn
http://precarcinogen.c7630.cn
http://www.zhongyajixie.com/news/101557.html

相关文章:

  • 企业邮箱注册价格杭州百度整站优化服务
  • 企业网站管理系统破解版百度联盟注册
  • html怎么做查询网站吗什么是网站推广
  • 网站如何做首面关键词海东地区谷歌seo网络优化
  • 有哪些好的模板网站长沙正规关键词优化价格从优
  • wordpress一步步建企业网站关键词快速排名平台
  • 优秀网站设计欣赏什么是网站推广
  • 网络公司网站模板html广州的百度推广公司
  • 新上线网站如何做搜索引擎免费网站提交入口
  • 泰国做网站友链购买有效果吗
  • 柬埔寨网站建设网络科技公司网站建设
  • 想做一个自己的网站怎么做的湖南网站建设seo
  • 英文网站建设官网上海seo推广方法
  • laravel 做中英文网站百度经验发布平台
  • 用hexo做网站网站模板搭建
  • 精选网站建立 推广 优化成都网站seo诊断
  • 卡地亚手表官方网站辽宁seo推广
  • 分析网站日志seo如何建立优化网站
  • 抚松做网站百度竞价排名公式
  • 开州网站建设中国网络优化公司排名
  • wordpress 同步 微博做搜索引擎优化的企业
  • 东莞做网站开发的公司老司机们用的关键词有哪些
  • 顺企网网站建设平台怎么推广
  • 装修公司最怕三种人天津网络优化推广公司
  • 合作网站开发公司产品免费推广网站有哪些
  • 一个企业的网站建设sem是什么职位
  • 西安本地十家做网站建设的公司营销课程培训都有哪些
  • wordpress首页模块修改seo全站优化全案例
  • 公务员可以自己做网站吗什么是关键词推广
  • 针对人群不同,网站做细分创建网站的基本步骤