基础知识
基础知识
Dream-chasing ant
鄙人水平不高,建立博客初心只是想留一份回忆给自己。
展开
-
快读模板
inline int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; }原创 2020-07-24 19:31:35 · 82 阅读 · 0 评论 -
int、long long、float、double的取值范围
int型 (2e9 ) 2^31-1 long long 型(1e19 )2^63-1 float型 -2^ 128~2^128 精度:6~7位 double型 -2^1024 ~ 2^1024 精度15~16位 long long型比int型慢好多原创 2020-03-12 21:20:48 · 413 阅读 · 0 评论 -
求逆序对数
求逆序对可以用归并排序、树状数组求。 传送门 归并排序 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=5e5+10; ll s[maxn],n,temp[maxn]; ll cnt; void merge(int l1,int r1,int l2,int r2){ i...原创 2020-03-07 23:02:57 · 183 阅读 · 0 评论 -
总结输入输出
文章目录printf/scanf使用getchar和putchar 的输入/输出格式cin/coutcin.get(字符数组名,接收长度,结束符)cin.getline(字符数组名,接收长度,结束符)getline(istream is,string str,结束符)gets printf/scanf 在scanf中,除了char数组整个输入不用加&,其他都要加 scanf内双引号的内容...原创 2020-02-16 15:04:08 · 117 阅读 · 0 评论