結果
| 問題 |
No.405 ローマ数字の腕時計
|
| ユーザー |
Bantako
|
| 提出日時 | 2017-07-11 22:01:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 312 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 23,168 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 19:12:20 |
| 合計ジャッジ時間 | 794 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
3 | main(){
| ^~~~
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s%d",S,&T);
| ~~~~~^~~~~~~~~~~~~
main.cpp:12:27: warning: ‘num’ may be used uninitialized in this function [-Wmaybe-uninitialized]
12 | printf("%s\n",str[(num+T+1200)%12]);
| ~~~^~
ソースコード
#include<stdio.h>
#include<string.h>
main(){
char str[][5] = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"};
char S[5];
int T;
scanf("%s%d",S,&T);
int num;
for(int i = 0;i < 12;i++){
if(!strcmp(str[i],S)){num=i;}
}
printf("%s\n",str[(num+T+1200)%12]);
}
Bantako