結果

問題 No.2407 Bouns 2.0
ユーザー elphe
提出日時 2025-02-14 15:21:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 971 ms
コンパイル使用メモリ 77,832 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-14 15:21:47
合計ジャッジ時間 2,157 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /usr/include/c++/13/iostream:41,
                 from main.cpp:1:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>]’,
    inlined from ‘int main()’ at main.cpp:39:10:
/usr/include/c++/13/ostream:198:25: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
  198 |         return _M_insert(static_cast<unsigned long>(__n));
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:15:18: note: ‘ans’ was declared here
   15 |         uint32_t ans;
      |                  ^~~

ソースコード

diff #

#include <iostream>
#include <cstdint>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	uint32_t W, Z;
	char B[4];
	cin >> W >> Z >> B;

	uint32_t ans;
	switch (B[2])
	{
	case '0':
		ans = (W + Z) * 3;
		break;

	case '2':
		ans = (W + Z) / 5 * 11;
		break;

	case '5':
		ans = (W + Z) / 2 * 3;
		break;

	case '6':
		ans = (W + Z) / 5 * 13;
		break;

	case '8':
		ans = (W + Z) / 5 * 9;
		break;
	}

	cout << ans << '\n';
	return 0;
}
0