結果

問題 No.494 yukicoder
ユーザー forest3
提出日時 2020-03-16 13:08:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 168,084 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-28 02:45:18
合計ジャッジ時間 2,420 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:14:25: warning: 'idx' may be used uninitialized [-Wmaybe-uninitialized]
   14 |         char ans = s[idx];
      |                         ^
main.cpp:9:13: note: 'idx' was declared here
    9 |         int idx;
      |             ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	string S;
	cin >> S;

	int idx;
	for( int i = 0; i < S.size(); i ++ ) {
		if( S[i] == '?' ) idx = i;
	}
	string s = "yukicoder";
	char ans = s[idx];

	cout << ans << endl;
}
0