結果

問題 No.544 Delete 7
ユーザー くれちー
提出日時 2016-12-22 17:27:57
言語 C90
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 340 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 20:28:43
合計ジャッジ時間 8,798 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
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), atoi(b) - 1);
	return 0;
}
0