-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path外挂.txt
71 lines (66 loc) · 1.54 KB
/
外挂.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma comment(linker,"/STACK:65536000")
int readint() //ÓÃÓÚÕûÊý
{
char c;
while (c = getchar(), '-' != c && !isdigit(c))
if(c == EOF) return EOF;
int f = 1;
if ('-' == c)
f = -1,c = getchar();
int x = c - '0';
while (isdigit(c = getchar()))
x = x * 10 + c - '0';
return x * f;
}
void write(int a) { //ÓÃÓÚÕýÕûÊý
if(a>9) write(a/10);
putchar(a%10+'0');
}
#include <cstdio>
#include <ext/rope>
__gnu_cxx::crope s;
int t,cur,k,i;
char op[10],buf[1<<21],c;
int main()
{
scanf("%d",&t);
for(;t>0;t--)
{
scanf("%s",op);
switch(op[0])
{
case 'M':
scanf("%d",&cur);
break;
case 'I':
scanf("%d",&k);i=0;
while(k)
{
c=getc(stdin);
if(c>=32&&c<=126)
{
buf[i++]=c;
k--;
}
}
buf[i]=0;
s.insert(cur,buf);
break;
case 'D':
scanf("%d",&k);
s.erase(cur,k);
break;
case 'G':
scanf("%d",&k);
puts(s.substr(cur,k).c_str());
break;
case 'P':
cur--;
break;
case 'N':
cur++;
break;
}
}
return 0;
}