ZOJ Monthly, November 2010解题报告 » ZOJ3432

ZOJ3432
ZOJ3432.c


#include <unistd.h>

long long buf[1 << 21];

int main(void) {
	char ch;
	int n, m, i;
	long long xor[2] = {0LL, 0LL};

	while (read(0, &ch, 1) > 0) {
		n = 0;
		do {
			n = n * 10 + (ch - '0');
			read(0, &ch, 1);
		} while (ch != '\n');
		m = n + n - 1;
		read(0, buf, 8 * m);
		*xor = 0;
		for (i = 0; i < m; ++i) {
			*xor ^= buf[i];
		}
		write(1, xor, 8);
	}

	return 0;
}

/*
Run ID 	Submit Time 	Judge Status 	Problem ID 	Language 	Run Time(ms) 	Run Memory(KB) 	User Name 	Admin
370 	2010-11-10 00:01:08 	Accepted 	F 	C 	30 	16536 	watashi@Zodiac 	Source
*/
4 Responses to “ZOJ3432”
  1. aswmtjdsj says:

    话说这个库里面的函数好强大啊。。。read和write竟然比getchar和putchar快了十倍以上??!!!

  2. David says:

    不好意思,这段代码看得不太懂,可以给一份易懂一点的么…..先谢谢了

  3.  
Leave a Reply