結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
tokizo
|
| 提出日時 | 2018-01-14 15:35:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 802 bytes |
| コンパイル時間 | 591 ms |
| コンパイル使用メモリ | 78,988 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-24 02:47:28 |
| 合計ジャッジ時間 | 1,319 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 11 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:35:10: warning: 't1' may be used uninitialized [-Wmaybe-uninitialized]
35 | if(t + t1 < 0){
| ~~^~~~
main.cpp:26:9: note: 't1' was declared here
26 | int t1;
| ^~
ソースコード
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
#include <ctype.h>
#include <string>
#include <stdio.h>
using namespace std;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
int main()
{
INIT;
string s;
int t;
cin >> s >> t;
string R[13] = {"XII", "I", "II", "III", "IIII", "V", "VII", "VIII", "IX", "X", "XI", "XII"};
int t1;
REP(i, 12){
if(s == R[i]){
t1 = i;
break;
}
}
int t2;
if(t + t1 < 0){
t2 = 12 - (abs(t + t1) % 12);
}else{
t2 = (t + t1) % 12;
}
cout << R[t2] << endl;
return 0;
}
tokizo