提出 #46082397


ソースコード 拡げる

#include <iostream>
#include <string>

using namespace std;

int main(){
  int n, m;
  string s, t;
  cin >> n >> m >> s >> t;
  bool pref = false;
  bool suff = false;
  if (t.compare(0, n, s) == 0){
    pref = true;
  }
  if (t.compare(t.size() - n, n, s) == 0){
    suff = true;
  }
  if (pref && suff){
    cout << 0 << endl;
  }else if (pref && !suff){
    cout << 1 << endl;
  }else if (!pref && suff){
    cout << 2 << endl;
  }else {
    cout << 3 << endl;
  }
  return 0; 
}

提出情報

提出日時
問題 B - Prefix and Suffix
ユーザ ThousandthStar
言語 C++ 17 (gcc 12.2)
得点 200
コード長 514 Byte
結果 AC
実行時間 1 ms
メモリ 3676 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 4
AC × 24
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 03_hack_00.txt, 03_hack_01.txt, 03_hack_02.txt, 03_hack_03.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3468 KiB
00_sample_01.txt AC 1 ms 3556 KiB
00_sample_02.txt AC 1 ms 3520 KiB
00_sample_03.txt AC 1 ms 3528 KiB
01_random_00.txt AC 1 ms 3536 KiB
01_random_01.txt AC 1 ms 3616 KiB
01_random_02.txt AC 1 ms 3564 KiB
01_random_03.txt AC 1 ms 3564 KiB
01_random_04.txt AC 1 ms 3676 KiB
01_random_05.txt AC 1 ms 3528 KiB
01_random_06.txt AC 1 ms 3428 KiB
01_random_07.txt AC 1 ms 3524 KiB
01_random_08.txt AC 1 ms 3468 KiB
01_random_09.txt AC 1 ms 3564 KiB
01_random_10.txt AC 1 ms 3428 KiB
01_random_11.txt AC 1 ms 3440 KiB
02_corner_00.txt AC 1 ms 3556 KiB
02_corner_01.txt AC 1 ms 3432 KiB
02_corner_02.txt AC 1 ms 3556 KiB
02_corner_03.txt AC 1 ms 3464 KiB
03_hack_00.txt AC 1 ms 3524 KiB
03_hack_01.txt AC 1 ms 3672 KiB
03_hack_02.txt AC 1 ms 3528 KiB
03_hack_03.txt AC 1 ms 3480 KiB