結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
|
提出日時 | 2020-09-08 17:25:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 2,407 ms |
コンパイル使用メモリ | 197,424 KB |
最終ジャッジ日時 | 2025-01-14 08:34:30 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘std::string solve()’: main.cpp:12:17: warning: ‘t1’ may be used uninitialized [-Wmaybe-uninitialized] 12 | ans = v[(1200 + t1 + t) % 12]; | ~~~~~^~~~ main.cpp:6:10: note: ‘t1’ was declared here 6 | int t, t1; | ^~
ソースコード
#include <bits/stdc++.h> #define rep(i, ss, ee) for (int i = ss; i < ee; ++i) using namespace std; string solve() { int t, t1; string s1, ans; cin >> s1 >> t; vector<string> v{"XII", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI"}; rep(i, 0, 12) if (v[i] == s1) t1 = i; ans = v[(1200 + t1 + t) % 12]; return ans; } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << solve() << endl; getchar(); }