【OI】快读
不必多说。
#include <cstdio>
#include <cstring> int read(){
int x = ,f = ;
char c = getchar(); while(c < '' || c > '') {
if(c == '-') f = -;
c = getchar();
}
while(c>= '' && c<= ''){
x = x* + c-'';
c = getchar();
} return x*f;
} int main()
{
for(int i = ; i <= ; i ++){
int x = read();
printf("%d",x);
} return ;
}
【OI】快读的更多相关文章
- 卡常三连(快读快写+re)
快读: inline int in() { char ch; ; '))); a*=;a+=ch-'; ,a+=ch-'; return a; } 快写: inline void out(int a) ...
- C++手写快读详解(快速读入数字)
众所周知,C++里是自带读入的(这不废话吗) 例如: int a; cin>>a; 这样的读入理解简单,适合初学者,但是非常慢. 再例如: int a; scanf("%d&qu ...
- 快读&快写模板【附O2优化】
快读&快写模板 快读快写,顾名思义,就是提升输入和输出的速度.在这里简单介绍一下几种输入输出的优劣. C++ cin/cout 输入输出:优点是读入的时候不用管数据类型,也就是说不用背scan ...
- C/C++快读(快速读入)有多——安全AC
在一些算法题目中中,有的程序会被卡常(数),就是说,程序虽然渐进复杂度,(通俗来讲:算法的时间复杂度)可以接受,但因为算法本身的时间常数过大,导致程序在一些算法竞赛中超时.这是,快读就显得尤为重要了. ...
- C++读入神器——文操快读(oj也可以用)
当某天,本蒟蒻沉迷于卡常的时候: 我-- 突然,YYKdalao说:用文操快读啊! 然后 喔-目瞪口呆 不多说,上源码: 本来用的读入方式: inline void Read( int &x ...
- int快读
昨天偶然间看到CJ_tony的快读,所以便决定学习一下. 这个快读的原理就是:读入单个字符要比读入读入数字快,先读入字符,然后再转化成数字.(原理的话大学再研究) 代码: #include<io ...
- c++快读与快输模板
快读 inline int read() { ; ; char ch=getchar(); ; ch=getchar();} )+(X<<)+ch-'; ch=getchar();} if ...
- c++ 快读快输模板
快读 inline int read() { ; ; char ch=getchar(); ; ch=getchar();} )+(X<<)+ch-'; ch=getchar();} if ...
- C++快读模板
C++的快速读入模板 inline int read() { ; char ch = getchar(); ') { if (ch == '-') flag = true; ch = getchar( ...
- [C/C++]快速读入代码(快读)
快读 1.为什么要有快读 好吧,有些题目看上去十分简单,例如https://www.luogu.com.cn/problem/P4305这道题,实际上数据量巨多,光是一个测试点就可能有几个MB,在这种 ...
随机推荐
- 洛谷P3747 [六省联考2017]相逢是问候
传送门 题解 扩展欧拉定理. 线段树维护,已经全改到底了的节点就不管,不然暴力修改下去. //Achen #include<algorithm> #include<iostream& ...
- java udp协议DatagramSocket类使用
package com.temp; import org.junit.Test; import java.io.*; import java.net.DatagramPacket; import ja ...
- swoole入门abc
1. 入门abc 1.1 github账号添加 第一步依然是配置git用户名和邮箱 git config user.name "用户名" git config user.email ...
- C++11的for循环的新用法
字符串 string str = "this is a string"; for(auto ch : str) cout << ch << endl; 等价 ...
- php工作中常用到的linux命令
压缩并指定目录举例:zip -r /home/kms/kms.zip /home/kms/server/kms 解压并指定目录举例:unzip /home/kms/kms.zip -d /home/k ...
- [转]Event loop——浏览器和Node区别
最近对Event loop比较感兴趣,所以了解了一下.但是发现整个Event loop尽管有很多篇文章,但是没有一篇可以看完就对它所有内容都了解的文章.大部分的文章都只阐述了浏览器或者Node二者之一 ...
- ubuntu setup.py 安装时报Error -5 while decompressing data: incomplete or truncated stream
缺少 python-devel 包 apt-get install python-dev -y
- 【C++】从最简单的vector中sort用法到自定义比较函数comp后对结构体排序的sort算法
sort函数在使用中非常好用,也非常简单,而且效率与冒泡或者选择排序不是一个数量级.本文就sort函数在vector中的用法分为sort函数入门用法与自定义comp比较函数比较结构体这两个最基本的功能 ...
- vue 使用 element ui动态添加表单
html部分 <div class="hello"> <el-form :model="dynamicValidateForm" ref=&q ...
- GYM100741 A Queries
A. Queries time limit per test 0.25 s memory limit per test 64 MB input standard input output standa ...