結果
| 問題 |
No.1367 文字列門松
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2021-01-30 17:46:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 994 bytes |
| コンパイル時間 | 926 ms |
| コンパイル使用メモリ | 93,168 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 05:34:48 |
| 合計ジャッジ時間 | 1,710 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 1367.cc: No.1367 文字列門松 - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 10;
const char t[] = "kadomatsu";
/* typedef */
/* global variables */
char s[MAX_N + 4];
bool dp[MAX_N + 1][MAX_N + 1];
/* subroutines */
/* main */
int main() {
scanf("%s", s);
int sn = strlen(s), tn = strlen(t);
if (sn > tn) { puts("No"); return 0; }
dp[0][0] = true;
for (int i = 0; i <= sn; i++)
for (int j = 0; j <= tn; j++)
if (dp[i][j]) {
if (i < sn && j < tn && s[i] == t[j]) dp[i + 1][j + 1] = true;
if (i < tn) dp[i][j + 1] = true;
}
if (dp[sn][tn]) puts("Yes");
else puts("No");
return 0;
}
tnakao0123