結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-12 01:03:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 735 bytes |
| コンパイル時間 | 1,523 ms |
| コンパイル使用メモリ | 167,836 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 19:26:55 |
| 合計ジャッジ時間 | 2,185 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:28:19: warning: 'now' may be used uninitialized [-Wmaybe-uninitialized]
28 | if ((ans=(now + t) % 12) < 0){
| ~~~~~^~~~
main.cpp:20:11: note: 'now' was declared here
20 | int t,now;
| ^~~
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;
int main() {
string in,rome[12] = {"I",
"II",
"III",
"IIII",
"V",
"VI",
"VII",
"VIII",
"IX",
"X",
"XI",
"XII"};
int t,now;
cin >> in >> t;
rep(i,12) {
if(rome[i]==in)
now = i;
}
int ans;
if ((ans=(now + t) % 12) < 0){
ans = 12 + ans;
}
cout << rome[ans] << endl;
return 0;
}