結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
mine691
|
| 提出日時 | 2019-03-27 19:36:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 646 ms |
| コンパイル使用メモリ | 68,576 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 05:15:45 |
| 合計ジャッジ時間 | 1,533 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
const int INF = 1e9 + 7;
string s;
int a = INF, n;
int main()
{
cin >> s;
n = s.size();
for (int i = 0; i < n; i++)
{
if (s[i] != 'c')
continue;
for (int j = i + 1; j < n; j++)
{
if (s[j] != 'w')
continue;
for (int k = j + 1; k < n; k++)
{
if (s[k] == 'w')
a = min(k - i + 1, a);
}
}
}
if (a == INF)
a = -1;
cout << a << endl;
}
mine691