結果
問題 | No.293 4>7の世界 |
ユーザー |
![]() |
提出日時 | 2015-11-10 21:36:08 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 530 bytes |
コンパイル時間 | 487 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 11:33:19 |
合計ジャッジ時間 | 1,182 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s%s",a,b); | ^~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>#include<string.h>int main(void){char a[16], b[16];char *ans;int i=0;scanf("%s%s",a,b);if(strlen(a) > strlen(b)) ans = a;else if(strlen(a) < strlen(b)) ans = b;else{while(1){if(a[i] != b[i]){if(a[i] =='7' && b[i] == '4'){ans = b;break;}else if(a[i] =='4' && b[i] == '7'){ans = a;break;}else if(a[i] > b[i]){ans = a;break;}else if(a[i] < b[i]){ans = b;break;}}i++;}}printf("%s\n",ans);return 0;}