結果

問題 No.544 Delete 7
ユーザー くれちー
提出日時 2016-12-22 17:27:31
言語 C90
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 344 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 20:28:34
合計ジャッジ時間 2,414 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 45 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s", n);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

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

int main() {
	char n[11];
	scanf("%s", n);
	int len = strlen(n);

	char a[11], b[11];
	int i;
	for (i = 0; i < len; i++) {
		if (n[i] == '7') {
			a[i] = '1';
			b[i] = '6';
		}
		else {
			a[i] = '0';
			b[i] = n[i];
		}
	}

	printf("%d %d\n", atoi(a) + 1, atoi(b) - 1);
	return 0;
}
0