結果
問題 | No.203 ゴールデン・ウィーク(1) |
ユーザー |
![]() |
提出日時 | 2015-12-15 05:34:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 416 bytes |
コンパイル時間 | 607 ms |
コンパイル使用メモリ | 70,800 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 09:36:25 |
合計ジャッジ時間 | 1,561 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:29:17: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 29 | cout << ans << endl; | ^~~
ソースコード
#include<iostream> #include<string> #include<fstream> #include<iomanip> #include<vector> #include<cctype> #include<algorithm> using namespace std; int main() { string s, t; cin >> s >> t; s += t; int ans; string r = "o"; for (int i = 1; i <= 14; i++) { for (int j = 0; j <= 14 - i; j++) { if (s.substr(j, i) == r) { ans = i; break; } } r += "o"; } cout << ans << endl; return 0; }