Codeforces 258 Div2

Materials Studio与LAMMPS联合作战:如何用msi2lmp.exe完美转换聚合物模型(含PCFF力场配置) 本文详细解析了如何利用msi2lmp.exe工具将Materials Studio中的聚合物模型高效、准确地转换为LAMMPS可识别的data文件,并重点配置PCFF力场。文章提供了从MS模型构建、文件导出到命令行转换、参数调整及转换后验证的全流程实战指南与避坑技巧,旨在帮助研究者解决模型转换中的常见问题,实现跨平台分子动力学模拟的无缝衔接。 阅读详情

A题,n*m根木棍,相交放置,轮流取走相交的两根,最后谁不能行动,则输掉。

min(n,m)&1 为1则先取者赢。

B题,给定一个长度为n,且各不相同的数组,问能否通过交换连续一段L....R使得变成单调递增。

如果一开始就是递增的,那么直接输出L。。。R就是1 1,交换一个就行了;否则判断中间是否有且一段单调递减,且两端交换后使得数组递增。

代码:

  1 //Template updates date: 20140718
  2 #include <iostream>
  3 #include <sstream>
  4 #include <cstdio>
  5 #include <climits>
  6 #include <ctime>
  7 #include <cctype>
  8 #include <cstring>
  9 #include <cstdlib>
 10 #include <string>
 11 #include <stack>
 12 #include <set>
 13 #include <map>
 14 #include <cmath>
 15 #include <vector>
 16 #include <queue>
 17 #include <algorithm>
 18 #define  esp 1e-6
 19 #define  inf 0x3f3f3f3f
 20 #define  pi acos(-1.0)
 21 #define  pb push_back
 22 #define  lson l, m, rt<<1
 23 #define  rson m+1, r, rt<<1|1
 24 #define  lowbit(x) (x&(-x))
 25 #define  mp(a, b) make_pair((a), (b))
 26 #define  bit(k) (1<<(k))
 27 #define  iin  freopen("pow.in", "r", stdin);
 28 #define  oout freopen("pow.out", "w", stdout);
 29 #define  in  freopen("solve_in.txt", "r", stdin);
 30 #define  out freopen("solve_out.txt", "w", stdout);
 31 #define  bug puts("********))))))");
 32 #define  Inout iin oout
 33 #define  inout in out
 34 
 35 #define  SET(a, v) memset(a, (v), sizeof(a))
 36 #define  SORT(a)   sort((a).begin(), (a).end())
 37 #define  REV(a)    reverse((a).begin(), (a).end())
 38 #define  READ(a, n) {REP(i, n) cin>>(a)[i];}
 39 #define  REP(i, n) for(int i = 0; i < (n); i++)
 40 #define  VREP(i, n, base) for(int i = (n); i >= (base); i--)
 41 #define  Rep(i, base, n) for(int i = (base); i < (n); i++)
 42 #define  REPS(s, i) for(int i = 0; (s)[i]; i++)
 43 #define  pf(x) ((x)*(x))
 44 #define  mod(n) ((n))
 45 #define  Log(a, b) (log((double)b)/log((double)a))
 46 #define Srand() srand((int)time(0))
 47 #define random(number) (rand()%number)
 48 #define random_range(a, b) (int)(((double)rand()/RAND_MAX)*(b-a) + a)
 49 
 50 using namespace std;
 51 typedef long long  LL;
 52 typedef unsigned long long ULL;
 53 typedef vector<int> VI;
 54 typedef pair<int,int> PII;
 55 typedef vector<PII> VII;
 56 typedef vector<PII, int> VIII;
 57 typedef VI:: iterator IT;
 58 typedef map<string, int> Mps;
 59 typedef map<int, int> Mpi;
 60 typedef map<int, PII> Mpii;
 61 typedef map<PII, int> Mpiii;
 62 
 63 const int maxn = 100000 + 100;
 64 int a[maxn];
 65 
 66 int main() {
 67 
 68     int n;
 69     Rep(i, scanf("%d", &n), n+1) scanf("%d", a+i);
 70     int l = 0, r = 0;
 71     int ok = 0;
 72     a[n+1] = inf;
 73     Rep(i, 1, n+2) {
 74         if(a[i] > a[i-1]) {
 75             if(!l)
 76                 continue;
 77             else {
 78                 if(ok && !r)
 79                     r = i-1;
 80             }
 81         } else if(a[i] < a[i-1]) {
 82             if(!ok)
 83                 ok = 1, l = i-1;
 84             if(r) {
 85                 cout<<"no"<<endl;
 86                 return 0;
 87             }
 88         } else {
 89             cout<<"no"<<endl;
 90             return 0;
 91         }
 92     }
 93     if(l) {
 94         if(a[l] < a[r+1] && a[r] > a[l-1]) {
 95             cout<<"yes"<<endl;
 96             cout<<l <<' '<<r<<endl;
 97         } else {
 98             cout<<"no"<<endl;
 99         }
100     } else {
101         cout<<"yes"<<endl;
102         cout<<1<<' '<<1<<endl;
103     }
104     return 0;
105 }
View Code

写得挫。

C题,3个球队,总共n场比赛,已进行k场,知道两个球队之间赢得场数的绝对值,如|x1-x2| = d1, |x2-x3| = d2, 问剩下的比赛中是否存在一种可能使得三个队伍赢得场数相等。

分析:题意知道每场比赛只用知道谁赢就行 ,不用顾忌各种规则,前k场中分别可能情况:

令x = x2;

x+d1, x, x+d2;

x+d1, x, x-d2;

x-d1, x, x+d2;

x-d1, x, x-d1;

对应4种情况求出x,在求出x1,x2,x3,判断满足0<=xi<=n/3 && xi <= k;

就可以了。

代码:

 1 //Template updates date: 20140718
 2 #include <iostream>
 3 #include <sstream>
 4 #include <cstdio>
 5 #include <climits>
 6 #include <ctime>
 7 #include <cctype>
 8 #include <cstring>
 9 #include <cstdlib>
10 #include <string>
11 #include <stack>
12 #include <set>
13 #include <map>
14 #include <cmath>
15 #include <vector>
16 #include <queue>
17 #include <algorithm>
18 #define  esp 1e-6
19 #define  inf 0x3f3f3f3f
20 #define  pi acos(-1.0)
21 #define  pb push_back
22 #define  lson l, m, rt<<1
23 #define  rson m+1, r, rt<<1|1
24 #define  lowbit(x) (x&(-x))
25 #define  mp(a, b) make_pair((a), (b))
26 #define  bit(k) (1<<(k))
27 #define  iin  freopen("pow.in", "r", stdin);
28 #define  oout freopen("pow.out", "w", stdout);
29 #define  in  freopen("solve_in.txt", "r", stdin);
30 #define  out freopen("solve_out.txt", "w", stdout);
31 #define  bug puts("********))))))");
32 #define  Inout iin oout
33 #define  inout in out
34 
35 #define  SET(a, v) memset(a, (v), sizeof(a))
36 #define  SORT(a)   sort((a).begin(), (a).end())
37 #define  REV(a)    reverse((a).begin(), (a).end())
38 #define  READ(a, n) {REP(i, n) cin>>(a)[i];}
39 #define  REP(i, n) for(int i = 0; i < (n); i++)
40 #define  VREP(i, n, base) for(int i = (n); i >= (base); i--)
41 #define  Rep(i, base, n) for(int i = (base); i < (n); i++)
42 #define  REPS(s, i) for(int i = 0; (s)[i]; i++)
43 #define  pf(x) ((x)*(x))
44 #define  mod(n) ((n))
45 #define  Log(a, b) (log((double)b)/log((double)a))
46 #define Srand() srand((int)time(0))
47 #define random(number) (rand()%number)
48 #define random_range(a, b) (int)(((double)rand()/RAND_MAX)*(b-a) + a)
49 
50 using namespace std;
51 typedef long long  LL;
52 typedef unsigned long long ULL;
53 typedef vector<int> VI;
54 typedef pair<int,int> PII;
55 typedef vector<PII> VII;
56 typedef vector<PII, int> VIII;
57 typedef VI:: iterator IT;
58 typedef map<string, int> Mps;
59 typedef map<int, int> Mpi;
60 typedef map<int, PII> Mpii;
61 typedef map<PII, int> Mpiii;
62 
63 LL n, k, d1, d2;
64 int a[][2] = {{-1, 1} ,{-1, -1}, {1, 1}, {1, -1}};
65 
66 int main() {
67     int T;
68     for(int t = scanf("%d", &T); t <= T; t++) {
69         scanf("%I64d%I64d%I64d%I64d", &n, &k, &d1, &d2);
70         if(n%3) {
71             puts("no");
72             continue;
73         }
74         int ok = 0;
75         LL nn;
76         REP(i, 4) {
77             nn = k;
78             LL tmp = (LL)a[i][0]*d1+(LL)a[i][1]*d2;
79             nn -= tmp;
80             if(nn < 0 || nn%3)
81                 continue;
82             nn /= 3;
83             if(nn > n/3 || nn > k)
84                 continue;
85             LL x1 = nn+(LL)a[i][0]*d1;
86             LL x2 = nn+(LL)a[i][1]*d2;
87             if(x1 < 0 || x1 > n/3 || x2 < 0 || x2 > n/3 || x1 > k || x2 > k)
88                 continue;
89             ok = 1;
90             break;
91         }
92         puts(ok ? "yes" : "no");
93     }
94     return 0;
95 }
View Code

D题,给定仅有‘a','a'组成的字符串,定义一种子串:通过合并连续的字母最后可以得到一个回文串。如”aaabbaaa"最后得到"aba"。

很容易想到一个字串首尾字符相等时就为这样的要求的特殊字串。

题目要求奇数长度和偶数长度这样的字串个数,统计每个字符分别用dp[0][s[i]-'a'], dp[1][s[i]-'a'],表示位于i及之前的奇数位置和偶数位置的s[i]字符个数,

这样偶数长度ans0 += dp[!(i&1)][s[i]-'a'], 奇数长度ans1 += dp[i&1][s[i]-'a'];

代码:

 1 //Template updates date: 20140718
 2 #include <iostream>
 3 #include <sstream>
 4 #include <cstdio>
 5 #include <climits>
 6 #include <ctime>
 7 #include <cctype>
 8 #include <cstring>
 9 #include <cstdlib>
10 #include <string>
11 #include <stack>
12 #include <set>
13 #include <map>
14 #include <cmath>
15 #include <vector>
16 #include <queue>
17 #include <algorithm>
18 #define  esp 1e-6
19 #define  inf 0x3f3f3f3f
20 #define  pi acos(-1.0)
21 #define  pb push_back
22 #define  lson l, m, rt<<1
23 #define  rson m+1, r, rt<<1|1
24 #define  lowbit(x) (x&(-x))
25 #define  mp(a, b) make_pair((a), (b))
26 #define  bit(k) (1<<(k))
27 #define  iin  freopen("pow.in", "r", stdin);
28 #define  oout freopen("pow.out", "w", stdout);
29 #define  in  freopen("solve_in.txt", "r", stdin);
30 #define  out freopen("solve_out.txt", "w", stdout);
31 #define  bug puts("********))))))");
32 #define  Inout iin oout
33 #define  inout in out
34 
35 #define  SET(a, v) memset(a, (v), sizeof(a))
36 #define  SORT(a)   sort((a).begin(), (a).end())
37 #define  REV(a)    reverse((a).begin(), (a).end())
38 #define  READ(a, n) {REP(i, n) cin>>(a)[i];}
39 #define  REP(i, n) for(int i = 0; i < (n); i++)
40 #define  VREP(i, n, base) for(int i = (n); i >= (base); i--)
41 #define  Rep(i, base, n) for(int i = (base); i < (n); i++)
42 #define  REPS(s, i) for(int i = 0; (s)[i]; i++)
43 #define  pf(x) ((x)*(x))
44 #define  mod(n) ((n))
45 #define  Log(a, b) (log((double)b)/log((double)a))
46 #define Srand() srand((int)time(0))
47 #define random(number) (rand()%number)
48 #define random_range(a, b) (int)(((double)rand()/RAND_MAX)*(b-a) + a)
49 
50 using namespace std;
51 typedef long long  LL;
52 typedef unsigned long long ULL;
53 typedef vector<int> VI;
54 typedef pair<int,int> PII;
55 typedef vector<PII> VII;
56 typedef vector<PII, int> VIII;
57 typedef VI:: iterator IT;
58 typedef map<string, int> Mps;
59 typedef map<int, int> Mpi;
60 typedef map<int, PII> Mpii;
61 typedef map<PII, int> Mpiii;
62 
63 
64 const int maxn = 100000 + 100;
65 char s[maxn];
66 LL dp[2][2];
67 int main() {
68     
69     scanf("%s", s);
70     LL ans1 = 0, ans2 = 0;
71     REPS(s, i) {
72         int x = s[i]-'a';
73         int y = i&1;
74         dp[y][x]++;
75         ans1+=dp[y][x];
76         ans2+=dp[y^1][x];
77     }
78     cout<<ans2<<' '<<ans1<<endl;
79     return 0;
80 }
View Code

 

E题,n个箱子装有fi朵花,箱子内花完全一样,箱子之间花看做不同,求从中选出s朵花,有多少选法?

我也不会数论,不过还是硬着头皮看懂了。以后要慢慢积累啊

分析: 设第i个箱子选出xi朵花。得到x1+x2+x3.....xn = s, 且0<=xi<=fi.

那么选花方案数就是解的组数,即(1+x+x^2+x^3+.....x^f1)*................(1+x+x^2+x^3+x^4.........x^fn)

= (1-x^(f1+1))******(1-x^(fn+1)) *(1-x)^(-n)(等比数列)中x^s系数

然后就是求里面x^s的系数了。

这个先算出前面部分各次幂的系数诚意后面(1-x)^(-n)相应系数,使得总系数为s。

其中(1-x)^(-n)幂为k的系数为C(n+k-1, k) = C(n+k-1, n-1)由于n很小(n<=20).

所以可以通过枚举法求前面的系数,然后C(n+k-1,n-1)利用逆元公式。

代码:

 

Unity中URP实现水体效果(泡沫) 在上篇文章中,我们实现了水体的深度。在这篇文章中,我们来使用上篇文章采样后的深度图来实现水中的泡沫效果。 阅读详情

相关推荐

Python环境搭建和LabVIEW中的调用

本文主要介绍Python相关的环境搭建、Anaconda的使用以及在LabVIEW中调用Python的方法。

lvxisi的博客 6406

Codeforces Round #258 (Div. 2)[ABCD]

Codeforces Round #258 (Div. 2)[ABCD] ACM 题目地址:Codeforces Round #258 (Div. 2) A - Game With Sticks 题意:  Akshat and Malvika两人玩一个游戏,横竖n,m根木棒排成#型,每次取走一个交点,交点相关的横竖两条木棒要去掉,Akshat先手,给出n,m问谁赢

水果君の日常 1556

本地大模型5:在pycharm用python调用ollama本地大模型

python调用ollama本地大模型

weixin_74825941的博客 8391

Codeforces Round #258 (Div. 2) 小结

Codeforces Round #258 (Div. 2) 小结

一蓑烟雨 1284

拆开华为BBU5900,看看5G基站的大脑里到底装了啥?

本文深度拆解华为BBU5900,揭示5G基站核心处理单元的硬件架构与设计哲学。通过详细解析模块化设计、智能电源系统和动态散热方案,展现其支撑千兆速率、毫秒级时延的技术奥秘,为5G网络部署提供实用参考。

weixin_31456563的博客 592

LLaVA-1.5:多模态视觉问答新突破

LLaVA-1.5在多模态视觉问答(VQA)任务中取得了显著进展,主要得益于视觉-语言连接器的优化和特定任务数据集的增加。通过将连接器升级为两层MLP,模型在处理视觉与语言关系时表现更佳。同时,引入如OKVQA、OCRVQA等数据集,增强了模型在复杂视觉推理任务中的能力。在11个基准测试中,LLaVA-1.5超越了现有方法,展示了其强大的多模态能力。此外,模型通过提升输入图像分辨率、扩展语言模型和改进多语言能力,进一步提升了性能。尽管在短格式回答任务中初期表现不佳,但通过调整提示格式和微调,其性能显著提升

weixin_57060548的博客 957

Codeforces Round #258 (Div. 2)

Codeforces Round #258 (Div. 2) 题目链接 A:交叉点个数为min(n, m),所以直接判断min(n, m)的奇偶性即可 B:多开一个数组,保存重排后的序列,然后把两个序列从左边往右和从右边往左,推到都不相同的位置,然后在不相同的一段上,头尾比较判断相不相同即可 C:在纸上画一画很容易看出分4种情况讨论,分别是a > b > c, a b

Remilia's 933

Windows11家庭版开启虚拟化与WSL安装操作手册

Windows 11 家庭版完全支持 WSL 2,无需升级到专业版即可享受 Linux 开发环境。通过本手册介绍的步骤,您可以顺利安装和配置 WSL,并掌握系统更新后的维护技巧。WSL 为开发者提供了在 Windows 环境下使用 Linux 工具链的便利,尤其适合需要跨平台开发的场景。随着使用深入,您会发现 WSL 生态系统的强大之处,它不仅能提高开发效率,还能让 Windows 用户体验到 Linux 的强大功能。建议定期查看微软官方文档,了解 WSL 的最新功能和最佳实践。

m0_54846764的博客 3090

Codeforces Round #258 (Div. 2)Devu and Flowers 容斥原理

题目:Codeforces Round #258 (Div. 2)Devu and Flowers 题意:n个boxes ,第i个box有fi个flowers,每个boxes中的flowers完全相同,不同boxes的flowers不同,求从n个boxes中取出s个flowers的方案数。n 排列组合的题目,一解法可用容斥原理(inclusion exclusion principle)

冰 944

ABB机器人将实时坐标发送给西门子PLC的具体方法示例

ABB机器人将实时坐标发送给西门子PLC的具体方法示例

Robot_PLC_HMI_Automation 4920

YOLOv5改进之---EIoU,SIoU,AlphaIoU,FocalEIoU,Wise-IoU

本文主要针对yolov5的iou损失函数进行改进,主要涵盖EIoU,SIoU,AlphaIoU,FocalEIoU,Wise-IoU这几种损失

qq_41920323的博客 1477

Codeforces Round 258 (Div. 2) E. Devu and Flowers 生成函数

两种方案不同当且仅当两种方案中至少有一个花瓶选择花的数量不同。很小可以暴力计算组合数,总的时间复杂度为。项,可以直接枚举,即。

2301_80099230的博客 1009

瑞芯微RK3588/RK3576平台采集BT1120(fpga)驱动调试记录

本文介绍了在RK3576/RK3588平台上采集FPGA传输的BT1120数据的方法。主要内容包括:1)硬件连接需确认管脚复用和图像格式(通常为uyvy_2x8);2)设备树配置要点,如I2C总线设置、BT1120模式指定等;3)驱动适配注意事项,包括时钟极性、分辨率格式等关键参数;4)测试方法,通过media-ctl和v4l2-ctl工具验证数据采集。文中特别指出RK3576和RK3588配置的通用性,并提供了常见问题的排查思路。

bingdund的博客 937

codeforces Round #258(div2) B解题报告

B. Sort the Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Being a programmer, you like arrays a lot.

旅行者西瓜 945

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

【索引】Codeforces Round #258 (Div. 2)

Problem A: Game With Sticks(451A)

不慌不忙、不急不躁 947

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Codeforces Round #258 (Div. 2)题解

A. Game With Sticks 题意:给出n,m,表示有n根水平的木棍,m根竖直的木棍,每次选取一个交点,取掉相应的两根木棍,直到不存在交点位置。 // > Author: Webwei #include #include using namespace std; int main() { int n,m; cin>>n>>m; int p=min(n,m); if(p%

sinat_35121480的博客 455

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Codeforces Round #258 (Div. 2) C, D

C  typedef long long LL ; LL n , k , d1 , d2 ; LL A(LL a[4][4]){ return a[1][1]*a[2][2]*a[3][3] + a[1][2]*a[2][3]*a[3][1] + a[1][3]*a[2][1]*a[3][2] -

老李2009 670

codeforces 258div2 B Sort the Array

题目链接:http://codeforces.com/contest/451/problem/B 解题报告:给出一个序列,要你判断这个序列能不能通过将其中某个子序列翻转使其成为升序的序列。 我的做法有点不一样,我是将原来的序列先按照升序排好序,然后分别从头和尾开始扫,找到跟原来的数组不一样的子序列的区间,然后判断这个区间是不是原来的区间翻转而来。 1 #include<cst...

weixin_30797027的博客 73

Codeforces Round #258 (Div. 2) 总结

A. Game With Sticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After winning gold and silver in IOI 201

小马的博客 682

codeforces Round #258(div2) D解题报告

题目大意: 给出一串字符,只含有a和b。现在定义一个字串如若合并之后的字串是个回文字符串,就是一个good substrings,求出这样的字串有多少个,并输出长度为偶数和奇数的个数。 解法: 首先,我们需要注意到两个已知条件: 1. 字串可以合并,例如 abbaabbb 合并之后就是abab 2. 只有两个字符a,b 我们可以发现,合并之后的字串一定是aba或者abab类型的,那么合并之后的字串如果是回文的话,第一个字符肯定与最后一个字符相同,反之亦然。 我们可以进一步

旅行者西瓜 1067

Codeforces Round #258 (Div. 2)题解(ALL)

A. Game With Sticks

August_AC的专栏 827
上一篇: 斯坦纳树
下一篇: TC Asia Competition
rootial
博客等级 码龄15年 2粉丝 93原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址