結果
問題 | No.2460 #強調# |
ユーザー |
|
提出日時 | 2023-09-21 16:21:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 334 bytes |
コンパイル時間 | 566 ms |
コンパイル使用メモリ | 67,404 KB |
最終ジャッジ日時 | 2025-02-16 23:53:29 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:28: warning: ‘p1’ may be used uninitialized [-Wmaybe-uninitialized] 18 | cout << s.substr(p1+1, p2-1-p1) << endl; | ~~^~ main.cpp:8:13: note: ‘p1’ was declared here 8 | int p1, p2; | ^~ main.cpp:18:34: warning: ‘p2’ may be used uninitialized [-Wmaybe-uninitialized] 18 | cout << s.substr(p1+1, p2-1-p1) << endl; | ~~^~ main.cpp:8:17: note: ‘p2’ was declared here 8 | int p1, p2; | ^~
ソースコード
#include <iostream>#include <string>using namespace std;int main(){string s;cin >> s;bool pt = false;int p1, p2;for (int i=0; i < (int)s.size(); i++) {if (!pt && s[i]=='#') {p1 = i;pt = true;}else if (pt && s[i]=='#') {p2 = i;}}cout << s.substr(p1+1, p2-1-p1) << endl;return 0;}