关于快读快写一直过不去的问题,求调
  • 板块学术版
  • 楼主lwx20211103
  • 当前回复1
  • 已保存回复1
  • 发布时间2023/1/2 11:49
  • 上次更新2023/10/24 05:50:17
查看原帖
关于快读快写一直过不去的问题,求调
727008
lwx20211103楼主2023/1/2 11:49

模板

代码,已经超级卡常了死活过不去。

#define LOCAL

#include <iostream>

#include <cstdio>

using namespace std;

namespace ly

{

	namespace IO

	{

#ifndef LOCAL

#define SIZE (1 << 20)

		char in[SIZE], out[SIZE], *p1 = in, *p2 = in, *p3 = out;

#define getchar() (p1 == p2 && (p2 = (p1 = in) + fread(in, 1, SIZE, stdin), p1 == p2) ? EOF : *p1++)

#define flush() (fwrite(p3 = out, 1, SIZE, stdout))

#define putchar(ch) (p3 == out + SIZE && flush(), *p3++ = (ch))

		class Flush
		{
		public:
			~Flush() { flush(); }
		} _;

#endif

		template <typename type>

		inline void read(type &x)

		{

			x = 0;
			bool flag(0);
			char ch = getchar();

			while (!isdigit(ch))
				flag ^= ch == '-', ch = getchar();

			while (isdigit(ch))
				x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();

			flag ? x = -x : 0;
		}

		template <typename type>

		inline void write(type x, bool flag = 1)

		{

			x < 0 ? x = -x, putchar('-') : 0;
			static short Stack[50], top(0);

			do
				Stack[++top] = x % 10, x /= 10;
			while (x);

			while (top)
				putchar(Stack[top--] | 48);

			flag ? putchar('\n') : putchar(' ');
		}

#ifndef LOCAL

#undef SIZE

#undef getchar

#undef putchar

#undef flush

#endif

	}

}
using namespace ly::IO;

const int maxn = 1e7 + 5;

int nums[maxn];

main()
{
	int a;
	read(a);
	register int i;
	for (i = 1;i <= a;++i)
	{
		read(nums[i]);
	}
	for (i = a;i >= 1;--i)
	{
		write(nums[i], 0);
	}
	return 0;
}

2023/1/2 11:49
加载中...