結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
f843nmfwisfeuw
|
| 提出日時 | 2020-07-19 11:31:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 805 bytes |
| コンパイル時間 | 822 ms |
| コンパイル使用メモリ | 95,876 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 19:29:35 |
| 合計ジャッジ時間 | 1,537 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function 'int toInt(std::string)':
main.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
25 | }
| ^
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
using namespace std;
vector<string> r{"I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"};
int toInt(string S) {
for (int i = 0; i < r.size(); ++i) {
if (r[i] == S) {
return (i + 1) % 12;
}
}
}
string toStr(int n) {
if (n % 12 == 0) {
return r[11];
} else {
return r[n % 12 - 1];
}
}
int main() {
string S1;
int T;
cin >> S1 >> T;
int S = toInt(S1);
int at = S + T;
while (at < 0) {
at += 12;
}
cout << toStr(at % 12) << endl;
return 0;
}
f843nmfwisfeuw