c631.
記憶力試驗
| From: [27.52.9.157] |
發表日期
:
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;
}