結果

問題 No.558 575検出するやつ
ユーザー Toshihiko YanaseToshihiko Yanase
提出日時 2018-05-01 13:38:10
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 61,372 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 00:09:05
合計ジャッジ時間 1,253 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  string S;
  string sub = "575";
  cin >> S;

  if(S.size() < sub.size()){
    cout << "NO" << endl;
    return 0;
  }

  for(int i=0;i<S.size()-sub.size()+1;i++){
    bool flag = true;
    for(int j=0;j<sub.size();j++){
      if(S[i+j] != sub[j]){
	flag = false;
	break;
      }
    }
    if(flag){
      cout << "YES" << endl;;
      return 0;
    }
  }

  cout << "NO" << endl;

  return 0;
}
0