小工具知识网

当前位置: 首页 > 行业知识 > 第十五届蓝桥杯省赛大学B组(c++)

行业知识

第十五届蓝桥杯省赛大学B组(c++)

2026-10-28 09:54:00 来源:互联网转载

很幸运拿了辽宁赛区的省一,进入6月1号的国赛啦...

这篇文章主要对第十五届省赛大学B组(C++)进行一次完整的复盘,这次省赛==2道填空题+6道编程题:

A.握手问题

把握手情景看成矩阵:

粉色部分是7个不能互相捂手的情况

由于每个人只能和其他人捂手, 所以黑色情况是不算的

1和2握手==2和1握手,就是只用算一半的对角矩阵

#includeusing namespace std;int main(){    int a=0;    for(int i=49;i;i--) a+=i;    int b=0;    for(int i=6;i;i--) b+=i;    int ans=a-b;    cout
h2 B.小球反弹/h2 p这题考试的时候我是直接跳过的,到最后也没来得及看,看了估计也算不对,haha/p p整体思路是:/p p最终返回左上角时,小球走过的水平路程和垂直路程一定是343720和233333的偶数倍并且水平路程与垂直路程之比一定为15:17/p p对于后一个条件,很容易理解,因为两个方向上速度比是恒定的,接下来以极端情况简单说一下为什么只有到左上角小球走过的水平路程和垂直路程一定是343720和233333的偶数倍:/p pimg height="707" src="https://m.xiaogongju.com.cn/uploads/allimg/20250421/-250421225400940.png" width="1088" //p pimg height="657" src="https://m.xiaogongju.com.cn/uploads/allimg/20250421/-250421225400122.png" width="1086" //p pimg height="675" src="https://m.xiaogongju.com.cn/uploads/allimg/20250421/-250421225400V6.png" width="1031" //p pre #includeiostream#includecmathusing namespace std;typedef long long ll;const int N=1e4;const ll X=343720;const ll Y=233333;int main(){ for(ll x=2;x=N;x+=2){ for(ll y=2;y=N;y+=2){ if (15*Y*y==17*X*x){ printf("%lf",sqrt((X*x)*(X*x)+(Y*y)*(Y*y))); //结果是1100325199.770395 return 0; } } }}/pre h2C.好数/h2 p这题暴力枚举就能AC,数据不大,haha/p pre #includeiostreamusing namespace std;typedef long long ll;const int N=1e7+5;ll ans;bool check(int x){ int flag=0; while(x0){ int t=x%10; if(!flag){ if(t%2==0) return false; else flag=1; } else{ if(t%2!=0) return false; else flag=0; } x/=10; } return true;}int main(){ int n; cin>n; for(int i=1;in>>d; ll a=(ll)pow(2,n); double ans=a*d; double res=(ll)ans+0.5; if(ans>=res) cout>d; while(n--) ans=mul(ans,"2"); string newd="";int flag; for(int i=0;in; for(int i=1;i>h[i]; dfs(1,1); h[1]=h[res[1]],h[2]=h[res[2]],h[3]=h[res[3]]; sort(h+1,h+4); cout0&&q>0){ int tt=magic(t); if(tt==0){ if(q>p) pq.push(t/2),q--; else pq.push((int)sqrt(t)),p--; } else if(tt==1){ pq.push((int)sqrt(t)); p--; } else{ pq.push(t/2); q--; } } else if(p>0&&q0&&pn; for(int i=1;i>a[i]; a[i]+=a[i-1]; } for(int l1=1;l1

上一篇:毕业一年多了,这期间换了两个城市三分工作,都是不同行业不同职位,总没有自己特别满意的。现在想找一份自己能够干下去的满意的工作,但是好迷茫,不知道自己能干嘛……而且也不知道自己去杭州好还是苏州好。我要用心做的事情总能做好,但是现在没有目标……

下一篇:建立服务器怎么打开端口?