输入外挂
来源:互联网 发布:nginx module 编辑:程序博客网 时间:2024/05/21 10:56
输入数字的外挂
普通版正负整数:
#include <bits/stdc++.h>using namespace std;typedef long long LL;template <class T>inline bool rd(T &ret){ T x = 0, f = 1; char ch=getchar(); while (ch < '0' || ch > '9') { if(ch == EOF) return false; if (ch == '-') f = -1; ch = getchar(); } ret = 0; while (ch >= '0' && ch <= '9') { ret = ret * 10 + ch - '0'; ch = getchar(); } ret = ret * f; return true;}int main() { int a, b; while(rd(a)) { rd(b); printf("%d\n", a + b); }}
fread版本正负整数
#include <bits/stdc++.h>using namespace std;namespace IO { const int MT = 5 << 20; //5MB char buf[MT]; int c, sz; void begin() { c = 0; sz = fread(buf, 1, MT, stdin); } template<class T> inline bool read(T &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; }}using namespace IO;int main() { int a, b; begin(); while(read(a)) { read(b); cout << a + b << endl; }}
综合版
#include <bits/stdc++.h>using namespace std;//typedef __int128 lll;struct FastIO { static const int S = 5 << 20; //MB 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 && 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 lll xlll() {// lll 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(int 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]); }// inline void wlll(lll x) {// if(x < 0) wchar('-'), x = -x;//// char s[70];// lll n = 0;// while(x || !n) s[n ++] = '0' + x % 10, x /= 10;// while(n--) wchar(s[n]);// } inline void wstring(const char* s) { while(*s) wchar(*s++); } ~FastIO() { if(wpos) fwrite(wbuf, 1, wpos, stdout), wpos = 0; }} io;int main() { int a, b; while(1) { a = io.xint(); b = io.xint(); io.wint(a + b); io.wchar('\n'); } return 0;}
阅读全文
0 0
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- 【输入外挂】
- 输入外挂
- 输入外挂
- 输入外挂
- 输入外挂
- Session和Cookie简介
- mysql自动断开链接的问题,org.springframework.dao.RecoverableDataAccessException
- JS身份证号码验证
- 我的淘宝天猫购物返利微信机器人,不发广告,不发骚扰信息
- 【android】android中使用commons-codec框架处理各种加密解密
- 输入外挂
- 此题请去QDU找帅气的HYC与露珠
- 【03】前端面试题
- 网易调整队形(动态规划)
- yum [Errno 14] problem making ssl connection CentOs
- JZOJ3773【NOI模拟】小 P 的烦恼(拓扑排序,贪心,找桥)
- KMP
- java native 关键字
- iOS蓝牙开发 Bluetooth蓝牙CoreBluetooth 蓝牙中心设备的实现 蓝牙外设的实现 有Demo