当前位置:网站首页>读入、输出优化
读入、输出优化
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);
边栏推荐
- HCIP 第八天
- 概率论与数理统计
- MySQL - Index Optimization and Query Optimization
- Buried development process
- HCIP 第十二天
- Ask a question, my Flinkcdc has run through, I can monitor the binlog of msql, and I can also send kafk
- PanGu-Coder: A function-level code generation model
- 理论问题与工程问题的差异在哪里?
- Splunk Filed Alias 字段改名
- Splunk Filed extraction 字段截取
猜你喜欢
随机推荐
MySQL报错1055解决办法:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
Transimpedance amplifier
静态路由综合实验
HCIP第三天
typescript学习
CollectionUtil: a collection of functional style tool
OC-NSArray
Find the largest n files
PLSQL Developer安装和配置
flutter解决键盘和输入框不适配问题
ROS file system and related commands
Azure Synapse Analytics上创建用户并赋予权限
HCIP第二天
【Network】IP, subnet mask
Fatal error compiling: 无效的目标发行版: 11
OC-错误提示
pnpm + workspace + changesets 构建你的 monorepo 工程
(2022 Niu Ke Duo School 5) B-Watches (two points)
MGRE环境下的OSPF
HCIP 第十一天