当前位置:网站首页>读入、输出优化
读入、输出优化
2022-08-02 07:20:00 【*﹏ℳ๓无情*】
关闭同步
ios::sync_with_stdio(false), cin.tie(0);
//cin和cout 不能和其他的scanf,printf,puts,sscanf,sprintf,getchar等混用
整形
读入
template <typename T> inline T read()
{
T sum = 0, fl = 1;
int ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-')
fl = -1;
for (; isdigit(ch); ch = getchar())
sum = sum * 10 + ch - '0';
return sum * fl;
}
//a=read<int>();
输出
template <typename T> inline void write(T x)
{
if (x < 0)
putchar('-'), x *= -1;
if (x > 9)
write(x / 10);
putchar(x % 10 | '0');
}
//write(a);
边栏推荐
猜你喜欢

Understand the Chisel language. 30. Chisel advanced communication state machine (2) - FSMD: Take Popcount as an example

HCIP第三天

2022年防止网络攻击的15个网络安全实践,你学会了吗?

OC-错误提示

Splunk Filed Alias 字段改名

MySQL - low level settings

Hack The Box - File Transfers Module详细讲解中文教程

PanGu-Coder:函数级的代码生成模型

【Unity3D】初学加密技巧(反破解)

Inverter insulation detection detection function and software implementation
随机推荐
View port number occupancy
OC-NSNumber and NSValue are generally used for boxing and unboxing
初探形式化方法基本原理
(2022 Niu Ke Duo School 5) D-Birds in the tree (tree DP)
redis-advanced
FormData upload binary file, object, object array
MySQL-索引优化和查询优化
Transimpedance amplifier
HCIP 第八天
mysql操作入门(四)-----数据排序(升序、降序、多字段排序)
MySQL-Multiversion Concurrency Control
Hack The Box - File Transfers Module详细讲解中文教程
OC-Category
spark read local file
【Unity3D】初学加密技巧(反破解)
Xilinx Constraint Study Notes - Timing Constraints
ROS file system and related commands
LeetCode 283. Shifting Zeros (Simple, Array)
redis-高级篇
Metasploit(MSF)基础超级详细版