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

马肤
这是懒羊羊

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

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

A.握手问题

把握手情景看成矩阵:

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

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

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

#include
using 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的偶数倍/p p并且水平路程与垂直路程之比一定为15:17/p pre class="brush:python;toolbar:false"#includeiostream #includecmath using 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 h2 C.好数/h2 p这题暴力枚举就能AC,数据不大,haha/p pre class="brush:python;toolbar:false"#includeiostream using 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

文章版权声明:除非注明,否则均为VPS857原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复:表情:
评论列表 (暂无评论,0人围观)

还没有评论,来说两句吧...

目录[+]

取消
微信二维码
微信二维码
支付宝二维码