結果
問題 | No.201 yukicoderじゃんけん |
ユーザー |
![]() |
提出日時 | 2015-05-04 00:10:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 23,552 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 18:05:46 |
合計ジャッジ時間 | 695 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%s %s %c\n%s %s %c", s[0], p[0], &x[0], s[1], p[1], &x[1]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> int compare(char[], char[]); int main(void) { char s[3][101], p[2][10002], x[2]; scanf("%s %s %c\n%s %s %c", s[0], p[0], &x[0], s[1], p[1], &x[1]); s[2][0] = '-'; s[2][1] = '1'; s[2][2] = '\0'; // ひどい printf("%s\n", s[ compare(p[0], p[1]) ] ); return 0; } int compare(char a[], char b[]) { int la = strlen(a), lb = strlen(b); if( la > lb ) { return 0; } if( la < lb ) { return 1; } int i; for(i = 0; i < la; i++) { if( a[i] > b[i] ) { return 0; } if( a[i] < b[i] ) { return 1; } } return 2; }