結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
Espece
|
| 提出日時 | 2017-12-16 08:48:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 858 bytes |
| コンパイル時間 | 732 ms |
| コンパイル使用メモリ | 71,368 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 19:15:02 |
| 合計ジャッジ時間 | 1,320 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:39:17: warning: ‘t0’ may be used uninitialized in this function [-Wmaybe-uninitialized]
39 | if ((t0 + t) < 0) t2 = 12 - (abs(t0 + t) % 12);
| ~~~~^~~~
ソースコード
#include<iostream>
#include<string>
#include<cstring>
#include<complex>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
#define REP(i, j) for (int i = 0; i < (int)j; ++i)
#define FOR(i, j, k) for (int i = (int)j; i < (int)k; ++i)
#define SORT(v) sort(v.begin(), v.end())
#define REVERSE(v) reverse(v.begin(), v.end())
typedef complex<double> P;
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PII;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
vector<string> ss = {"XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI", "XII"};
string s1;
int t;
cin >> s1 >> t;
int t0;
REP(i,ss.size()) {
if (ss[i] == s1) {
t0 = i;
break;
}
}
int t2;
if ((t0 + t) < 0) t2 = 12 - (abs(t0 + t) % 12);
else t2 = (t0 + t) % 12;
cout << ss[t2] << endl;
return 0;
}
Espece