結果

問題 No.494 yukicoder
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-20 19:37:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 234 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 68,016 KB
最終ジャッジ日時 2025-01-05 00:45:08
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:20: warning: ‘index’ may be used uninitialized [-Wmaybe-uninitialized]
   13 |   cout << ans[index] << endl;
      |                    ^
main.cpp:9:7: note: ‘index’ was declared here
    9 |   int index;
      |       ^~~~~

ソースコード

diff #

#include <iostream>

using namespace std;
 
int main() {
  string s;
  cin >> s;
  string ans = "yukicoder";
  int index;
  for(int i = 0; i < 9; i++) {
    if(s[i] != ans[i]) index = i;
  }
  cout << ans[index] << endl;
  return 0;
}
0