蓝桥杯知识点整理

慈云数据 2024-03-15 技术支持 60 0

知识点:

1、基本输入输出语法

蓝桥杯知识点整理
(图片来源网络,侵删)

(1)如cin速度比scanf慢 两者遇到空格回车会停止读入

(2)若想读整行需要cin.getline()或gets函数

蓝桥杯知识点整理
(图片来源网络,侵删)

(3)读到文件尾用scanf()!=EOF等等

(4)占位符‘%’相关格式,如对齐方式,补0等。

2、C/C++库函数以及stl模板

(1)algorithm: sort next_permutation lower_bound/upper_bound

(2)queue(priority_queue) stack vector set map基本操作

3、数据结构

(1)结构体:注意结构体用sort排序,可自定义cmp函数,也可在结构体内重载“ return b?gcd(b,a%b):a; } return a/gcb(a,b)*b; } return a+bb+a; } If(n If(n%i==0) return false; } Return true; } Int ans=1; while(n){ If(n&1) ans*=a; a*=a; n=1;//n右移一位,把刚处理过的n的最后一位去掉 } return ans; } Ll ans=1; A%=mod; while(n){ If(n&1) ans=(ans*a)%mod; A=a*a%modl N=1; } Return ans; } Int mid=(L+R+1)/2; If(check(mid)) L=mid; Else R=mid-1; } Cout Int mid=(L+R)/2; If(check(mid)) L=mid+1; Else R=mid; } Cout Sum[i]=sum[i-1]+a[i]; } For(int i=1;i S+=sum[i-1]*a[i]; } Cout // 判断是否为质数 if(a == 2){ return true; } if(a

微信扫一扫加客服

微信扫一扫加客服

点击启动AI问答
Draggable Icon