Submission #00241


ソースコード

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
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
char s[11];
cin >> s;
int size = 0, n, count = 0;
bool check = false;
for (int i = 0; s[i]; i++) {
size++;
}
cin >> n;
char k[n][11];
for (int i = 0; i < n; i++) {
cin >> k[i];
}
for (int l = 0; l < n; l++) {
int turn = 0;
int j = 0;
while (j < size) {
for (int i = 0; i < 10; i++) {
//cout << l << " " << i << " " << j << " " << count << endl;
if (s[j] == k[l][i]) {
j++;
} else if (j != 0) {
j = 0;
i--;
}
if (j == size) {
i = 11;
j = size;
count++;
//cout << l << " " << i << " " << j << " " << count << endl;
}
if (i == 9 && j != 0 && turn == 0) {
i = -1;
turn++;
} else if (i == 9) {
i = 11;
j = size;
//cout << l << " " << i << " " << j << " " << count << endl;
}
}
}
}
cout << count << "\n";
return(0);
}

ステータス

項目 データ
問題 0018 - 指輪 (Ring)
ユーザー名 woody_1227
投稿日時 2022-06-02 07:38:45
言語 C++17
状態 Accepted
得点 45
ソースコード長 1170 Byte
最大実行時間 24 ms
最大メモリ使用量 636 KB

セット

セット 得点 Cases
1 入力1 9 / 9 *1.txt
2 入力2 9 / 9 *2.txt
3 入力3 9 / 9 *3.txt
4 入力4 9 / 9 *4.txt
5 入力5 9 / 9 *5.txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
s1.txt AC 23 ms 604 KB
1
s2.txt AC 22 ms 444 KB
2
s3.txt AC 24 ms 540 KB
3
s4.txt AC 19 ms 636 KB
4
s5.txt AC 19 ms 604 KB
5