【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,在这种 ...
随机推荐
- spring cloud深入学习(八)-----配置中心svn示例和refresh
svn版本 同样先示例server端的代码,基本步骤一样. 1.添加依赖 <dependencies> <dependency> <groupId>org.spri ...
- Python技巧—list与字符串互相转换
Python技巧-list与字符串互相转换 在Python的编程中,经常会涉及到字符串与list之间的转换问题,下面就将两者之间的转换做一个梳理. 1.list转换成字符串 命令:list() 例子: ...
- 解决 Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'
If you are looking for the solution in Android Studio : Right click on your app Open Module Settings ...
- angular报错:angular.min.js:118Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq
报错代码如下: <div ng-controller="HelloAngular"> <p>{{greeting.text}},angular</p& ...
- spring MVC4 配置详解(个人记录)
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- 前端(jQuery)(9)-- jQuery菜单
1.垂直菜单布局 2.垂直菜单实现 <!DOCTYPE html> <html lang="en"> <head> <meta chars ...
- 项目中的那些事---下载pdf文件
最近做了一个下载pdf文档的需求,本以为使用HTML5中<a>标签的属性download就能简单搞定,不料IE竟然不支持这一简单粗暴的H5新特性,而是直接在网页中打开, 于是各种搜索之后得 ...
- fastjson 对象和json互转
list转json List<Openid> openids = od.getAll(session); String json = JSONObject.toJSONString(ope ...
- jodatime 计算时间差_统计程序运行耗时
https://blog.csdn.net/De_Moivre/article/details/79775661 记录开始执行的时间 DateTime startDateTime=new DateTi ...
- [jnhs]全套CRC校验 算法
摘自 https://blog.csdn.net/cp1300/article/details/51443350 uint8_t crc4_itu(uint8_t *data, uint_len le ...