#17028: C的,不會再看


freedom501999@gmail.com (帥氣魔方生)

School : No School
ID : 88611
IP address : [39.8.203.54]
Last Login :
2019-05-30 22:56:25
c631. 記憶力試驗 | From: [27.52.9.157] | Post Date : 2019-03-01 14:00

#include <stdio.h>
#include <string.h>
char buf[100000];
int main(void)
{
	int N, L[700]={0}, R[700]={0}, n=0, i, j, len;
	scanf("%d", &N);
	fseek(stdin, N+1+1, SEEK_CUR);
	while(scanf("%d %d", &L[n], &R[n])!=EOF)
	{
		n++;
	}
	for(i=0;i<n;i++)
	{
		rewind(stdin);
		scanf("%*d%*c");
		fseek(stdin, L[i]-1, SEEK_CUR);
		len= R[i]-L[i]+1;
		if(len <= 100000)
		{
			memset(buf,0,sizeof(buf));
			fread(buf, sizeof(char), len, stdin);
			printf("%.*s", len, buf);
		}
		else
		{
			while(len > 100000)
			{
				memset(buf,0,sizeof(buf));
				fread(buf, sizeof(char), 100000, stdin);
				printf("%.*s", 100000, buf);
				len -= 100000;
			}
			memset(buf,0,sizeof(buf));
			fread(buf, sizeof(char), len, stdin);
			printf("%.*s", len, buf);
		}
		printf("\n");
	}
	return 0;
}
 
#17029: Re:C的,不會再看


asnewchien@gmail.com (david)

School : 南投縣立草屯國中
ID : 68108
IP address : [36.232.35.202]
Last Login :
2020-06-25 14:31:11
c631. 記憶力試驗 | From: [61.223.44.184] | Post Date : 2019-03-01 14:16

 

解出來就貼答案,真是的。

 
ZeroJudge Forum