C++外挂,
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void _cin1(T &ret) //读正整数 (int, long long)
{
char c;
ret = 0;
while((c = getchar()) < '0' || c > '9');
while(c >= '0' && c <= '9')
{
ret = ret * 10 + (c - '0');
c = getchar();
}
}
template <class T>
inline bool _cin2(T &ret) //读正整数并判断文件结束 (int, long long)
{
char ch;
if(ch = getchar(), ch == EOF) return 0;
while(ch < '0' || ch > '9') ch = getchar();
for(ret = 0; ch >= '0' && ch <= '9'; ch = getchar())
ret = ret * 10 + ch - '0';
return 1;
}
template <class T>
inline void _cin3(T &ret) //读正负整数 (int, long long)
{
char ch;
int flag = 0;
while((ch = getchar()) < '0' || ch > '9')
{
if(ch == '-') flag = 1;
}
for(ret = 0; ch >= '0' && ch <= '9'; ch = getchar())
ret = ret * 10 + ch - '0';
if(flag) ret *= -1;
}
template <class T>
inline bool _cin4(T &ret) //读正负整数且判断文件结束 (ing, long long)
{
char ch;
int flag = 0;
if(ch = getchar(), ch == EOF) return 0;
while(ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if(ch == '-')
{
flag = 1;
ch = getchar();
}
for(ret = 0; ch >= '0' && ch <= '9'; ch = getchar())
ret = ret * 10 + ch - '0';
if(flag) ret *= -1;
return 1;
}
template <class T>
void _cout(T ret) //输出外挂 (int, long long)
{
if(ret < 0)
{
putchar('-');
ret = -ret;
}
if(ret > 9) _cout(ret/10);
putchar(ret%10 + '0');
}
template <class T>
inline bool _scanf(T &ret) //读入整数浮点数并判断文件结束 (int, long long, float, double)
{
char c;
int sgn;
T bit = 0.1;
if(c = getchar(), c == EOF) return 0;
while(c != '-' && c != '.' && (c < '0' || c > '9')) c = getchar();
sgn = (c == '-')? -1 : 1;
ret = (c == '-')? 0: (c-'0');
while(c = getchar(), c >= '0' && c <= '9') ret = ret*10 + (c-'0');
if(c == ' ' || c == '\n')
{
ret *= sgn;
return 1;
}
while(c = getchar(), c >= '0' && c <= '9')
{
ret += (c-'0')*bit, bit /= 10;
}
ret *= sgn;
return 1;
}
int main()
{
long long n;
_cin1(n);
cout << n << endl;
while(_cin2(n)) cout << n << endl;
_cin3(n);
cout << n << endl;
while(_cin4(n)) cout << n << endl;
cin >> n;
_cout(n);
double f;
_scanf(n); printf("%lld\n", n);
_scanf(f); printf("%.3f\n", f);
return 0;
}
其实上面的手写输入挂不够高效,下面贴一下fread超强输入挂= =
#include<bits/stdc++.h>
#define ll long long
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';
}
inline void read(int &x)
{
char ch;
while(blank(ch = nc()));
if(IOerror) return;
for(x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0');
}
#undef BUF_SIZE
};
using namespace fastIO;
using namespace std;
int main()
{
int n;
freopen("in.txt", "r", stdin);
while(read(n), !IOerror) cout << n << endl;
return 0;
}
继续加油~