fread读入挂

版本一
```
namespace fastIO {
#define BUF_SIZE 100000
//fread -> read
bool IOerror = 0;
inline char nc() {
static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
if(p1 == pend) {
p1 = buf;
pend = buf + fread(buf, 1, BUF_SIZE, stdin);
if(pend == p1){
IOerror = 1;
return -1;
}
}
return *p1++;
}
inline bool blank(char ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
template
inline void read(T &x) {
char ch;
while(blank(ch = nc()));
if(IOerror)
return;
for(x = ch - '0'; (ch = nc()) >= '0' && ch using namespace fastIO;

<br>
版本二

struct FastIO {

static const int S = 1e7;

int wpos;

char wbuf[S];

FastIO() : wpos(0) {}

inline int xchar() {

static char buf[S];

static int len = 0, pos = 0;

if (pos == len)

pos = 0, len = fread(buf, 1, S, stdin);

if (pos == len) exit(0);

return buf[pos++];

}

inline int xuint() {

int c = xchar(), x = 0;

while (c <= 32) c = xchar();

for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';

return x;

}

inline int xint() {

int s = 1, c = xchar(), x = 0;

while (c <= 32) c = xchar();

if (c == '-') s = -1, c = xchar();

for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';

return x * s;

}

inline void xstring(char *s) {

int c = xchar();

while (c <= 32) c = xchar();

for (; c > 32; c = xchar()) * s++ = c;

s = 0;

}

inline void wchar(int x) {

if (wpos == S) fwrite(wbuf, 1, S, stdout), wpos = 0;

wbuf[wpos++] = x;

}

inline void wint(LL x) {

if (x < 0) wchar('-'), x = -x;

char s[24];

int n = 0;

while (x || !n) s[n++] = '0' + x % 10, x /= 10;

while (n--) wchar(s[n]);

wchar('\n');

}

inline void wstring(const char s) {

while (
s) wchar(
s++);

}

~FastIO() {

if (wpos) fwrite(wbuf, 1, wpos, stdout), wpos = 0;

}

} io;

<br>
版本三

inline char nc(){

static char buf[100000],p1=buf,p2=buf;

return p1p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1p2)?EOF:p1++;

}

inline int _read(){

char ch=nc();int sum=0;

while(!(ch>='0'&&ch<='9'))ch=nc();

while(ch>='0'&&ch<='9')sum=sum
10+ch-48,ch=nc();

return sum;

}

<br>

版本四

include

include

using namespace std;

const int maxx=40000008;

char Input[maxx+5],*ipos;

define read() (strtol(ipos,&ipos,10))

int main() {

fread(Input,maxx,1,stdin);ipos=Input;

int n=read();

//Do something......
return 0;

}

<br>
版本五

const int STRSIZE=int(4e7);

char in1[STRSIZE];

char in=in1, tempend;

void Input() {

tempend=in+STRSIZE;

fread(in,1,STRSIZE,stdin);

}

inline void scan(int &x) {

char c=
(in++);

while(!(c>='0' && c<='9')) c=
(in++);

x=c-'0';

c=(in++);

while(c>='0' && c<='9') {

x=x
10+c-'0';

c=*(in++);

}

}

<br>
版本六

const int BufferSize=1<<16;

char buffer[BufferSize],head,tail;

inline char Getchar() {

if(headtail) {

int l=fread(buffer,1,BufferSize,stdin);

tail=(head=buffer)+l;

}

return *head++;

}

inline int read() {

int x=0,f=1;char c=Getchar();

for(;!isdigit(c);c=Getchar()) if(c'-') f=-1;

for(;isdigit(c);c=Getchar()) x=x10+c-'0';

return x
f;

}

inline void write(int x){

if(x>=10)write(x/10);

putchar(x%10+'0');

}

<br>
版本七

namespace IO {

const int MX = 4e7; //1e7占用内存11000kb

char buf[MX]; int c, sz;

void begin() {

c = 0;

sz = fread(buf, 1, MX, stdin);

}

inline bool read(int &t) {

while(c < sz && buf[c] != '-' && (buf[c] < '0' || buf[c] > '9')) c++;

if(c >= sz) return false;

bool flag = 0; if(buf[c] == '-') flag = 1, c++;

for(t = 0; c < sz && '0' <= buf[c] && buf[c] <= '9'; c++) t = t * 10 + buf[c] - '0';

if(flag) t = -t;

return true;

}

}


<br>
版本八

struct FastIO {

static const int S = 100 << 1;

int wpos;

char wbuf[S];

FastIO() : wpos(0) {}

inline int xchar() {

static char buf[S];

static int len = 0, pos = 0;

if (pos == len) {

pos = 0;

len = (int)fread(buf, 1, S, stdin);

}

if (pos == len) {

return -1;

}

return buf[pos++];

}

inline int xint() {

int s = 1, c = xchar(), x = 0;

while (c <= 32) {

c = xchar();

}

if (c == '-') {

s = -1;

c = xchar();

}

for (; '0' <= c && c <= '9'; c = xchar()) {

x = x * 10 + c - '0';

}

return x * s;

}

~FastIO() {

if (wpos) {

fwrite(wbuf, 1, wpos, stdout);

wpos = 0;

}

}

} io;

<br>
版本九:

namespace fastio{

int ptr, ye, Siz;

char temp[25], str[8333667], out[8333669];

void io_init(){

ptr = 0, ye = 0;

Siz = fread(str, 1, 8333667, stdin);

}

inline int read(){

int i, j, val = 0, fla = 1;

while (ptr<Siz&&(str[ptr] < 48 || str[ptr] > 57)) ptr++;

if(ptr>=Siz)return -1;

while (str[ptr] > 47 && str[ptr] < 58) fla = 0,val = (val * 10) + (str[ptr++] - 48);

if(fla)return -1;

return val;

}

inline void convert(long long x,bool flag){

int i, d = 0;

for (;

fread读入挂and普通读入挂and浮点数读入挂的更多相关文章

  1. 基于OpenSIPS做注册服务下,场景A打B,一方发起BYE挂断后收到500,另一方无法挂断的问题

    基于OpenSIPS做注册服务下,场景A打B,一方发起BYE挂断后收到500,另一方无法挂断的问题     最近在工作中遇到一个看似很奇怪的,排除起来很费劲,但最后的解决方式又及其简单的问题,下面我们 ...

  2. [bzoj4247][挂饰] (动规+排序)

    Description JOI君有N个装在手机上的挂饰,编号为1...N. JOI君可以将其中的一些装在手机上. JOI君的挂饰有一些与众不同——其中的一些挂饰附有可以挂其他挂件的挂钩.每个挂件要么直 ...

  3. C++读入神器——文操快读(oj也可以用)

    当某天,本蒟蒻沉迷于卡常的时候: 我-- 突然,YYKdalao说:用文操快读啊! 然后 喔-目瞪口呆 不多说,上源码: 本来用的读入方式: inline void Read( int &x ...

  4. JS挂马攻防

    JS挂马攻防实录 攻现在最多见的JS挂马方法有两种,一种是直接将JavaScript脚本代码写在网页中,当访问者在浏览网页时,恶意的挂马脚本就会通过用户的浏览器悄悄地打开网马窗口,隐藏地运行(图1), ...

  5. 为什么operator>>(istream&, string&)能够安全地读入长度未知的字符串?

    一般而言,实现"读入用户输入的字符串",程序中自然不能对用户输入的长度有所限定.这在C++中很容易实现,而在C中确没那么容易. 这一疑问,我在刚学C++的时候也在脑中闪现过:不过很 ...

  6. BZOJ4247挂饰

    Description     JOI君有N个装在手机上的挂饰,编号为1...N. JOI君可以将其中的一些装在手机上.     JOI君的挂饰有一些与众不同--其中的一些挂饰附有可以挂其他挂件的挂钩 ...

  7. C# Thread挂起线程和恢复线程

    前言 众所周知,Thread类中的挂起线程和恢复线程微软已标记过时,因为可能会造成问题   Resume()   恢复当前线程 已过时. Resumes a thread that has been ...

  8. BZOJ 4247: 挂饰 题解

    Description JOI君有N个装在手机上的挂饰,编号为1...N. JOI君可以将其中的一些装在手机上. JOI君的挂饰有一些与众不同--其中的一些挂饰附有可以挂其他挂件的挂钩.每个挂件要么直 ...

  9. 应用程序出现挂死,.NET Runtime at IP 791F7E06 (79140000) with exit code 80131506.

    工具出现挂死问题 1.问题描述 工具出现挂死问题,巡检IIS发现以下异常日志 现网系统日志: 事件类型:    错误 事件来源:    .NET Runtime 描述: Application: Di ...

随机推荐

  1. React中Class的概念

    Class的概念 一.简介 javaScript是面向对象的编程语言,可以说所以的能够被描述的事.物或抽象的东西,都是可以是对象.而我们记录的对象,会有具有同样的属性和行为. 为了节省重写相同的代码. ...

  2. mongodb4.0数据库权限配置

    今天给大家分享一个关于mongodb数据库权限配置的小知识点,这里呢,我用的是mongodb4.0版本,下载地址:https://www.mongodb.com/download-center/com ...

  3. vue 组件的简单使用01

    // 组件 自定义全局组件 Vue.component('mycom', { template: '<div v-on:click="count++">自定义组件 +{ ...

  4. 一场comet常规赛的台前幕后

    有出题的想法大概是#8比完之后,#8的比赛较易,应该是符合https://info.cometoj.com 上的常规赛难度说明. 我们几个觉得我们一定可以出质量更高的题. 那个时候在玩线段树的时碰巧想 ...

  5. 【Flutter学习】基本组件之图片组件Image

    一,概述 Image(图片组件)是显示图像的组件,一个显示图片的widget,支持图像格式:JPEG,PNG,GIF,动画GIF,WebP,动画WebP,BMP和WBMP. Image组件有多种构造函 ...

  6. ORACLE动态sql在存储过程中出现表或视图不存在的解决方法

    Oracle动态sql在存储过程中出现表或视图不存在的解决方法 CREATE OR REPLACE PROCEDURE P_test is strsql varchar2(2000); BEGIN   ...

  7. 工程师技术(一):启用SELinux保护、自定义用户环境、配置IPv6地址、配置聚合连接、配置firewalld防火墙

    一.启用SELinux保护 目标: 本例要求为虚拟机 server0.desktop0 配置SELinux: 确保 SELinux 处于强制启用模式 在每次重新开机后,此设置必须仍然有效 方案: SE ...

  8. 误将SELINUXTYPE看成SELINUX后,将其值改为disabled。导致操作系统服务启动,无法进入单用户模式

    环境:Redhat 6.4 ORACLE11g RAC 在安装ORACLE11g之前需要关闭操作系统的防火墙和SELinux. 1.关闭防火墙:iptables -F————————————清除防火墙 ...

  9. 原生Ajax( XHR 和 Fetch )

    原生Ajax 基本使用的四大步骤,简单易懂 ajax(异步javascript xml) 能够刷新局部网页数据而不是重新加载整个网页.接下来通过本文给大家介绍Ajax的使用四大步骤,非常不错,感兴趣的 ...

  10. XSS的原理分析与解剖:第四章(编码与绕过)*******************未看**********************

    0×01前言 很抱歉,这第四章被我推了几个月,今天是元旦难得有空,就把第四章写下.我先把主要使用的编码说下,介绍完会说下绕过. 本文建议与<杂谈如何绕过WAF>一同阅读. 0×02 URL ...