結果

問題 No.293 4>7の世界
ユーザー suppy193
提出日時 2016-06-27 14:01:58
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 12:09:13
合計ジャッジ時間 1,342 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%lld%lld", &a, &b);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
	
	long long int a, b;
	char a_str[15], b_str[15];
	int i;

	scanf("%lld%lld", &a, &b);
	sprintf(a_str, "%lld", a);
	sprintf(b_str, "%lld", b);
	
	if(strlen(a_str) == strlen(b_str)){
		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