#include<bits/stdc++.h>
const int RN=1e5;
char ib[RN+],*ip=ib+RN,ob[RN+],*op=ob;
inline int gc(){
ip==ib+RN?fread(ip=ib,,RN,stdin)[ib]=:;
return*ip++;
}
struct IO{
void flush(){
fwrite(ob,,op-ob,stdout),op=ob;
}
template<class T>//T=int,long long
IO&operator>>(T&x0){
T x=;
int f=;
if(ip<ib+RN-){
while(*ip<)*ip++=='-'?f=-:;
while(*ip>)x=x*+*ip++-;
}else{
int c=gc();
while(c<)c=='-'?f=-:;
while(c>)x=x*+c-,c=gc();
}
x0=x;
return *this;
}
IO&operator>>(char*s){
int c=gc();
while(c<)c=gc();
while(c>)*s++=c,c=gc();
*s=;
return *this;
}
template<class T>//T=int,long long,char
IO&operator<<(T x){
if(op>ob+RN)flush();
int ss[],sp=;
if(x<)*op++='-',x=-x;
do ss[++sp]=+x%;while(x/=);
while(sp)*op++=ss[sp--];
return *this;
}
IO&operator<<(char x){
if(op>ob+RN)flush();
*op++=x;
return *this;
}
IO&operator<<(const char*str){
int n=strlen(str);
if(op+n>ob+RN)flush();
if(n<RN)memcpy(op,str,n),op+=n;
else fwrite(str,,n,stdout);
return *this;
}
IO&operator<<(char*str){
return *this<<(const char*)str;
}
IO&operator<<(std::string str){
return *this<<str.data();
}
}io;
int main(){
freopen("in.txt","r",stdin);
int a,b;
io>>a>>b;
io<<a<<'+'<<b<<'='<<a+b<<'\n';
io<<"test_string_output\n";
char s[];
io>>s;
io<<s<<'\n';
io.flush();
freopen("o.txt","w",stdout);
for(int i=;i<;++i)io<<i<<' ';
io.flush();
return ;
}

输出读入优化——QAQ的更多相关文章

  1. c++ 读入优化、输出优化模板

    0. 在有些输入数据很多的变态题中,scanf会大大拖慢程序的时间,cin就更慢了,所以就出现了读入优化.其原理就是一个一个字符的读入,输出优化同理,主要使用getchar,putchar函数. 1. ...

  2. 读入优化&输出优化

    读入优化 int read() { ; ') ; '; ') num=num*+c-'; return ff*num; } 输出优化 void write(int x) { ) { putchar(' ...

  3. C++ 读入优化&输出优化

    读入优化:读入优化只是针对整数,由于getchar()读字符非常的快,所以采用getchar()来进行读入,下设输入的数为x 负数处理:用一个标志变量f,开始时为1,当读入了'-'时,f变为-1,最后 ...

  4. fread读入优化,寻找速度极限

    序: 在之前的测试中,我们比较了四种读入方式,发现使用读入优化是最快的选择,但是我们知道fread()是比它更快的方法.这一次,我们对比四种读入优化,探寻C++读取速度的极限. 分别是getchar( ...

  5. c++读入优化

    对于输入数据非常大的一些可(变)爱(态)题目,scanf就会大大拖慢程序的运行速度,cin就更不用说了,所以我们要用一种高大上的东西——读入优化. 读入优化的原理其实就是一个一个字符的读入,再组成数字 ...

  6. OI黑科技:读入优化

    利用getchar()函数加速读入. Q:读入优化是什么? A :更加快速地读入一些较大的数字. Q:scanf不是已经够快了吗? A:Naive,scanf还是不!够!快! Q:那怎么办呢? A:我 ...

  7. ACM:读入优化

    两个简单的读入优化 int getin(){ ;; while(!isdigit(tmp=getchar()) && tmp!='-'); ,tmp=getchar(); )+(ans ...

  8. 【ACM非算法部分】读入优化

    今天做了ACdream的比赛才知道原来还有读入优化这一说.Orz 读入一个整数的时候这么写: int a; scanf("%d",&a); 和 int a; char c; ...

  9. 【CSP模拟赛】天才绅士少女助手克里斯蒂娜(线段树&读入优化&输出优化)

    题面描述 红莉栖想要弄清楚楼下天王寺大叔的显像管电视对“电话微波炉(暂定)”的影响.选取显像管的任意一个平面,一开始平面内有个n电子,初始速度分别为vi,定义飘升系数为 $$\sum_{1\leqsl ...

随机推荐

  1. Ado访问sqlserver 端口号非1433时 连接串的写法

    Provider=SQLOLEDB.;Persist Security Info=False;Data Source=hostName,Port //注意用 逗号分隔主机名与端口号

  2. DrawGrid 做图片显示 代码简单 参考性强 (Delphi7)

      运行效果图 源码 http://files.cnblogs.com/lwm8246/DrawGrid_demo.rar   procedure TfrmMain.GridDrawCell(Send ...

  3. ZOJ3553 概率DP

    Bloodsucker In 0th day, there are n-1 people and 1 bloodsucker. Every day, two and only two of them ...

  4. Leetcode 173. 二叉搜索树迭代器

    题目链接 https://leetcode.com/problems/binary-search-tree-iterator/description/ 题目描述 实现一个二叉搜索树迭代器.你将使用二叉 ...

  5. windows禁用/启用hyper-V,解决hyper-V与模拟器同时启用时造成冲突

  6. python和matlab

    一.python简介 python是一种面向对象的解释型计算机程序设计语言.python是纯粹的自由软件,源代码和解释器CPython遵循GPL协议.Python语法简介清晰,特色之一是强制用空白符作 ...

  7. Trident整合Kafka

    首先编写一个打印函数KafkaPrintFunction import org.apache.storm.trident.operation.BaseFunction; import org.apac ...

  8. android版本vqmon移植IOS版

    IOS交叉编译 1.android版本 vqmon已经正常运行,现需要开放IOS版本,作移植工作. 2. 注意事项: 1)ROOT权限,IOS必须越狱.  2)依赖库:pcap, ffmpeg,lib ...

  9. [转]全图形PPT设计指南

    三.什么时候使用 全图形PPT并不适用于所有时候,一般来说,我们在以下场合可以考虑使用:陈述一个故事.名人简介.产品介绍.读书笔记.心灵鸡汤.生活情趣等. 四.如何制作全图形PPT 全图形PPT的制作 ...

  10. [网站公告]1月10日1:00-7:00阿里云RDS维护会造成30秒闪断

    大家好! 阿里云将于1月10号1:00-7:00(今天夜里)对杭州机房部分RDS实例所在的物理主机做维护操作,维护期间部分RDS实例会有1-2次闪断,每次闪断时间在30秒以内. 我们使用的RDS实例将 ...