結果
問題 |
No.201 yukicoderじゃんけん
|
ユーザー |
![]() |
提出日時 | 2017-06-29 19:35:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 16:49:08 |
合計ジャッジ時間 | 1,081 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
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:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%s %s %*c",S1,P1); | ~~~~~^~~~~~~~~~~~~~~~~~~ main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s %s %*c",S2,P2); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<string.h> main(){ char P1[10001],P2[10001]; char S1[101],S2[101]; char c; int i; scanf("%s %s %*c",S1,P1); scanf("%s %s %*c",S2,P2); if(strlen(P1) > strlen(P2)){ printf("%s\n",S1); return 0; }else if(strlen(P1) < strlen(P2)){ printf("%s\n",S2); return 0; } for(int i = 0;i < strlen(P1);i++){ if(P1[i] > P2[i]){ printf("%s\n",S1); return 0; }else if(P1[i] < P2[i]){ printf("%s\n",S2); return 0; } } printf("-1\n"); }