結果

問題 No.1735 C#
ユーザー #leucobird#leucobird
提出日時 2021-11-18 22:39:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 71,612 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 17:16:24
合計ジャッジ時間 1,435 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:13:22: 警告: ‘num’ may be used uninitialized [-Wmaybe-uninitialized]
   13 |   std::cout << v2[num] << std::endl;
      |                      ^
main.cpp:9:7: 備考: ‘num’ はここで定義されています
    9 |   int num;
      |       ^~~

ソースコード

diff #

#include <iostream>
#include <vector>

int main(void) {
  std::vector<char> v1 = { 'C', 'D', 'E', 'F', 'G', 'A', 'B' };
  std::vector<std::string> v2 = { "C#", "D#", "F", "F#", "G#", "A#", "C" };
  char c;
  std::cin >> c;
  int num;
  for (int i = 0; i < v1.size(); i++) {
    if (c == v1[i]) num = i;
  }
  std::cout << v2[num] << std::endl;
	return 0;
}
0