Submission #35811


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
int main(){
string s,str;
cin >> s >> str;
bool fin = false;
int check;
for(int i = 0;i < str.size() && !fin;i++){
check = i;
int j;
for(j = 0;j < s.size();j++){
if(s[j] != str[check]){
break;
}
check = (check + 1) % str.size();
}
if(j == s.size()){
fin = true;
}
if(!fin){
check = i;
for(j = 0;j < s.size();j++){
if(s[j] != str[check]){
break;
}
check--;
if(check < 0){
check = str.size() - 1;
}
}
if(j == s.size()){
fin = true;
}
}
}
if(fin){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
}

ステータス

項目 データ
問題 0938 - 魔剤が飲みたい
ユーザー名 ei1719
投稿日時 2018-05-15 23:36:07
言語 C++11
状態 Accepted
得点 1
ソースコード長 801 Byte
最大実行時間 27 ms
最大メモリ使用量 712 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
case1.txt AC 24 ms 480 KB
1
case2.txt AC 21 ms 712 KB
1
reverse1.txt AC 24 ms 560 KB
1
reverse2.txt AC 22 ms 408 KB
1
test1.txt AC 27 ms 512 KB
1
test2.txt AC 15 ms 616 KB
1
test3.txt AC 22 ms 588 KB
1