結果
| 問題 |
No.405 ローマ数字の腕時計
|
| ユーザー |
AQUA16573837
|
| 提出日時 | 2018-03-12 01:36:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 512 bytes |
| コンパイル時間 | 162 ms |
| コンパイル使用メモリ | 34,504 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 19:16:52 |
| 合計ジャッジ時間 | 848 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%s %d", s, &time);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;
//405
int main() {
char s[5], sample[][5] = {
"I", "II", "III", "IIII", "V", "VI",
"VII", "VIII", "IX", "X", "XI", "XII"
};
int time = 0, p;
scanf("%s %d", s, &time);
while (time < 0)
time += 12;
for (int i = 0; i < 12; i++) {
bool match = true; p = 0;
while (s[p] != 0)
match &= s[p] == sample[i][p], p++;
match &= s[p] == sample[i][p];
if (match)
time += i;
}
printf("%s\n", sample[time % 12]);
}
AQUA16573837