結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
knk
|
| 提出日時 | 2017-09-26 20:51:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 561 bytes |
| コンパイル時間 | 690 ms |
| コンパイル使用メモリ | 76,972 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 19:13:34 |
| 合計ジャッジ時間 | 1,469 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:21:5: warning: 'n' may be used uninitialized [-Wmaybe-uninitialized]
21 | n += t;
| ~~^~~~
main.cpp:16:7: note: 'n' was declared here
16 | int n;
| ^
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
typedef long long ll;
int main(void)
{
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(3);
std::vector< std::string > rom = {"", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"};
std::string s1;
int t;
std::cin >> s1 >> t;
int n;
for (int i = 1; i <= 12; ++i) {
if (s1 == rom[i]) n = i;
}
while (t < 0) t+=12;
n += t;
n %= 12;
if (n==0) n = 12;
std::cout << rom[n] << std::endl;
return 0;
}
knk