結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2016-03-13 21:23:19 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 650 ms |
コンパイル使用メモリ | 73,080 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-25 11:22:46 |
合計ジャッジ時間 | 1,632 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 20 |
コンパイルメッセージ
main.cpp: In function ‘int bfs(int, int)’: main.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type] 22 | } | ^
ソースコード
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) string str; int bfs(int now,int how){ int a,b; } int main() { cin >> str; int ans = INF; for(int i = 0;i < str.size();i++){ if(str[i] == 'c'){ int how = 0; for(int j = 0;j < str.size();j++){ if(str[j] == 'w') how++; if(how == 2) { ans = min(ans,j-i+1); break; } } } } if(ans == INF) cout << "-1" << endl; else cout << ans << endl; return 0; }