回答編集履歴
4
update
test
CHANGED
@@ -106,9 +106,9 @@
|
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
-
f
|
109
|
+
scanf("%s", n);
|
110
110
|
|
111
|
-
f
|
111
|
+
scanf("%s", m);
|
112
112
|
|
113
113
|
|
114
114
|
|
3
update
test
CHANGED
@@ -77,3 +77,85 @@
|
|
77
77
|
}
|
78
78
|
|
79
79
|
```
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
ご指摘を受けて修正版
|
84
|
+
|
85
|
+
```c
|
86
|
+
|
87
|
+
#include <stdio.h>
|
88
|
+
|
89
|
+
#include <string.h>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
char n[100001];
|
94
|
+
|
95
|
+
char m[100001];
|
96
|
+
|
97
|
+
char z[100001];
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
int main(){
|
102
|
+
|
103
|
+
memset(n, '\0', sizeof(n));
|
104
|
+
|
105
|
+
memset(m, '\0', sizeof(m));
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
fgets(n, 100001, stdin);
|
110
|
+
|
111
|
+
fgets(m, 100001, stdin);
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
int i, j, cnt=0, flg;
|
116
|
+
|
117
|
+
int x=strlen(m);
|
118
|
+
|
119
|
+
int y=strlen(n);
|
120
|
+
|
121
|
+
printf("n:%d\n",x);
|
122
|
+
|
123
|
+
printf("m:%d\n",y);
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
for(i=0;i<x;i++){
|
128
|
+
|
129
|
+
flg=1;
|
130
|
+
|
131
|
+
for(j=0;j<y;j++){
|
132
|
+
|
133
|
+
if(m[i] == n[j]){
|
134
|
+
|
135
|
+
strcpy(z,n+(j+1));
|
136
|
+
|
137
|
+
strcpy(n+j,z);
|
138
|
+
|
139
|
+
y--;
|
140
|
+
|
141
|
+
flg=0;
|
142
|
+
|
143
|
+
break;
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
cnt+=flg;
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
printf("count:%d\n",cnt);
|
154
|
+
|
155
|
+
return 0;
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
私の貧富マシンでも100000件を1分程度で終了しました。
|
2
update
test
CHANGED
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
flg=0;
|
62
62
|
|
63
|
-
|
63
|
+
break;
|
64
64
|
|
65
65
|
}
|
66
66
|
|
1
update
test
CHANGED
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
flg=0;
|
62
62
|
|
63
|
-
|
63
|
+
j=strlen(n);
|
64
64
|
|
65
65
|
}
|
66
66
|
|