結果

問題 No.293 4>7の世界
ユーザー suppy193
提出日時 2016-06-27 13:45:47
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-11 22:23:00
合計ジャッジ時間 877 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#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) != (int)(log((double)b))){
		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;
}
0