# __int128
C++ 支持的最大数据类型就是 longlong,再大就会爆掉,所以出现了__int128 类型,默认 gcc 是不支持编译的,但是在各大 OJ 上是可以运行的,__int128 不支持 cin、cout,所以需要自己写读入打印函数,也就是传统的快读快写
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
void read(__int128 &x){
int y=1;x=0;
char c=getchar();
while(c<'0' || c>'9'){
if(c=='-') y=-1;
c=getchar();
}
while(c>='0' && c<='9'){
x=x*10+c-'0';
c=getchar();
}
x*=y;
}
void print(__int128 x){
if(x<0){
cout<<'-';
x*=-1;
}
if(x>=10) print(x/10);
putchar(x%10+'0');
}
int main()
{
__int128 x;
read(x);
print(x);
return 0;
}
# atan2
函数原型: double atan2(double y,double x)
传进去一个向量,返回这个向量相对于 x 轴正方向的角度值,当向量朝向是 y 轴以上返回值为正,当向量朝向为 y 轴以下,返回值为负,所以值域为 (-pi,pi]
# stoi 函数 && atoi 函数
头文件 cstring
作用:将一个字符串转化为 int 类型,如果输入小数会省略小数点后面的,负数也可以输入
atoi: 接受 const char *,所以 string 类型需要调用 c_str () 转化一下,超过上界返回上界,超出下界返回下界
stoi: 接受 const string *,直接传入 string 即可,超出 int 范围会报错 runerror
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
string s; | |
cin>>s; | |
cout<<stoi(s)<<'\n'; | |
return 0; | |
} | |
/* | |
>>123 | |
<<123 | |
*/ |
# isalpha || islower || isupper || isdigit
传入字符判断
isalpha: 判断是否为字母
islower: 判断是否为小写字母
isupper: 判断是否为大写字母
isdigit: 判断是否为数字