快读快写板子
#include<cstdio>
using LL=long long;
inline LL read(int read_char()=std::getchar);
inline void write(LL x,int write_char(int)=std::putchar);
inline LL read(int read_char())
{
LL x=0;
bool f=0;
char ch=read_char();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f^=1;
ch=read_char();
}
while('0'<=ch&&ch<='9')
{
x=(x<<1)+(x<<3)+(ch^'0');
ch=read_char();
}
return x*(f?-1:1);
}
inline void write(LL x,int write_char(int))
{
if(x<0)
write_char('-'),x=-x;
if(x>9)
write(x/10);
write_char((x%10)^'0');
return;
}#include <cstdio>
#include <cctype>
#include <cstring>
#include <cstdint>
#ifdef __linux__
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#endif
namespace fast_IO
{
static const std::int32_t* const table = []() -> const std::int32_t*
{
static std::int32_t result[0x10000];
std::memset(result, -1, sizeof(result));
for (std::int32_t i = 48; i != 58; ++i)
for (std::int32_t j = 48; j != 58; ++j)
result[i << 8 | j] = (j & 15) * 10 + (i & 15);
return result;
}();
static const char* cursor = []() -> const char*
{
#ifdef __linux__
struct stat status;
fstat(STDIN_FILENO, &status);
return reinterpret_cast<const char*>(mmap(nullptr, status.st_size, PROT_READ, MAP_PRIVATE, STDIN_FILENO, 0));
#else
static char buffer[16 << 20];
std::fread(buffer, sizeof(char), sizeof(buffer) / sizeof(char), stdin);
return buffer;
#endif
}();
static inline auto r32() -> std::int32_t
{
std::int32_t number = 0;
bool sign = *cursor == 45 && ++cursor;
~table[*reinterpret_cast<const std::uint16_t*>(cursor)] && (number = number * 100 + table[*reinterpret_cast<const std::uint16_t*>(cursor)], cursor += 2);
~table[*reinterpret_cast<const std::uint16_t*>(cursor)] && (number = number * 100 + table[*reinterpret_cast<const std::uint16_t*>(cursor)], cursor += 2);
~table[*reinterpret_cast<const std::uint16_t*>(cursor)] && (number = number * 100 + table[*reinterpret_cast<const std::uint16_t*>(cursor)], cursor += 2);
~table[*reinterpret_cast<const std::uint16_t*>(cursor)] && (number = number * 100 + table[*reinterpret_cast<const std::uint16_t*>(cursor)], cursor += 2);
~table[*reinterpret_cast<const std::uint16_t*>(cursor)] && (number = number * 100 + table[*reinterpret_cast<const std::uint16_t*>(cursor)], cursor += 2);
for (std::isdigit(*cursor) && (number = number * 10 + (*cursor++ & 15)); std::isspace(*++cursor); );
return sign ? -number : number;
}
}
int n,sum;
int main()
{
n=fast_IO::r32();
for(int i=1;i<=n;i++)sum+=fast_IO::r32();
printf("%d",sum);
return 0;
}#include <stdio.h>
#include <string.h>
#include <stdint.h>
#define BUF (1 << 22)
#define putchar(x) (now ++[0] = (x)) // 重定义 putchar
typedef int i32;
uint8_t obuf[BUF + 17], // 需要多预留一点空间,防止缓冲区溢出引起错误
*now = obuf;
uint8_t fr[17];
inline void write(int x) {
if (!x) return(void)(putchar(48));
if (x == -2147483648) return(void)(memmove(now, "-2147483648", 11), now += 11);
uint8_t* tot = fr + 17;
(x < 0) && (now ++[0] = 45, x = -x);
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10),
(x) && ((-- tot)[0] = x % 10 | 48, x /= 10);
memmove(now, tot, fr + 17 - tot); // 内存复制
now += fr + 17 - tot;
}
main() {
int n, x; scanf("%d%d", &n, &x);
write(n), putchar(32), write(x), putchar(10);
for (int i = 1; i <= n; ++ i) {
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
write(x), putchar(10);
if (now - obuf > BUF) { // 存储到达一定量,清空缓冲区
fwrite(obuf, 1, now - obuf, stdout);
now = obuf;
}
}
fwrite(obuf, 1, now - obuf, stdout); // 在程序结束时也要输出
}