結果
| 問題 |
No.264 じゃんけん
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-03 15:38:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 778 bytes |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 27,136 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-03-03 15:38:57 |
| 合計ジャッジ時間 | 813 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:24: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
9 | char *result = "Won";
| ^~~~~
main.cpp:13:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
13 | result = "Drew";
| ^~~~~~
main.cpp:15:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
15 | result = "Won";
| ^~~~~
main.cpp:17:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
17 | result = "Lost";
| ^~~~~~
main.cpp:22:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
22 | result = "Lost";
| ^~~~~~
main.cpp:24:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
24 | result = "Drew";
| ^~~~~~
main.cpp:26:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
26 | result = "Won";
| ^~~~~
main.cpp:31:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
31 | result = "Won";
| ^~~~~
main.cpp:33:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
33 | result = "Lost";
| ^~~~~~
main.cpp:35:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
35 | result = "Drew";
|
ソースコード
#include <stdio.h>
int main(void){
int myself = 0;
scanf("%d",&myself);
int opp = 0;
scanf("%d",&opp);
char *result = "Won";
switch(myself) {
case 0:
if(opp == 0){
result = "Drew";
}else if(opp == 1){
result = "Won";
}else if(opp == 2){
result = "Lost";
}
break;
case 1:
if(opp == 0){
result = "Lost";
}else if(opp == 1){
result = "Drew";
}else if(opp == 2){
result = "Won";
}
break;
case 2:
if(opp == 0){
result = "Won";
}else if(opp == 1){
result = "Lost";
}else if(opp == 2){
result = "Drew";
}
break;
}
printf("%s",result);
}
sasa