Ejemplo 1: io rápido
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
return 0;
}
Ejemplo 2: fast io c ++
#include <bits/stdc++.h>
using namespace std;
template <typename T> void in(T& x) // fast input
{
x = 0; T f = 1;
char ch = getchar();
while (!isdigit(ch)) f = ch == '-' ? - f : f, ch = getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
x *= f;
}
template<typename T> void out(T n) //fast output
{
bool neg = 0;
if (n < 0)
n *= -1, neg = 1;
char snum[20];
int i = 0;
do
{
snum[i++] = n % 10 + '0';
n /= 10;
}
while (n);
--i;
if (neg)
putchar('-');
while (i >= 0)
putchar(snum[i--]);
putchar('n');
}
main() { //My Test
int n;
in(n);
out(n);
}
Ejemplo 3: fast io c ++
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
Ejemplo 4: entrada rápida c ++
void fastInput(int &x)
{
bool neg=false;
register int c;
x =0;
c=getchar();
if(c=='-')
{
neg = true;
c=getchar();
}
for(;(c>47 && c<58);c=getchar())
//bit shifting is faster than other operation
//here code below is same as
//x = x*10 + c-48
x = (x<<1) + (x<<3) +c -48;
if(neg)
x *=-1;
}
Ejemplo 5: fast io c ++
fastio.pythonanywhere.com
/* A tool to optimize execution time of C++ codes by replacing methods of
reading and writing variables */
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)