結果
問題 | No.293 4>7の世界 |
ユーザー |
![]() |
提出日時 | 2016-06-27 13:50:32 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 742 bytes |
コンパイル時間 | 118 ms |
コンパイル使用メモリ | 23,552 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-26 03:10:41 |
合計ジャッジ時間 | 1,228 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%lld%lld", &a, &b); | ^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <math.h>int main(void) {long long int a, b;char a_str[15], b_str[115];int i;scanf("%lld%lld", &a, &b);if((int)(log((double)a) / log(10.0)) != (int)(log((double)b) / log(10.0))){if(a > b){printf("%lld\n", a);}else{printf("%lld\n", b);}}else{sprintf(a_str, "%lld", a);sprintf(b_str, "%lld", b);i = 0;while(a_str[i] != '\0'){if(a_str[i] == '4' && b_str[i] == '7'){printf("%s\n", a_str);return 0;}else if(a_str[i] == '7' && b_str[i] == '4'){printf("%s\n", b_str);return 0;}else if(a_str[i] != b_str[i]){break;}i++;}if(a > b){printf("%lld\n", a);}else{printf("%lld\n", b);}}return 0;}