結果

問題 No.509 塗りつぶしツール
コンテスト
ユーザー bal4u
提出日時 2019-05-12 12:42:52
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 552 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 238 ms
コンパイル使用メモリ 38,240 KB
最終ジャッジ日時 2026-02-22 03:22:05
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// yukicoder: No.509 塗りつぶしツール
// 2019.5.12 bal4u

#include <stdio.h>

#define gc() getchar()
int ins(char *s)  // 文字列の入力 スペース以下の文字で入力終了
{
	char *p = s;
	do *s = gc();
	while (*s++ > ' ');
	*--s = 0;
	return s - p;
}

int a[10] = {3,2,2,2,3,2,3,2,4,3};
int b[10] = {3,1,1,1,3,1,3,1,5,3};
char n[10];

int main()
{
	int i, w, as, bs;

	w = ins(n);
	as = 1, bs = 2; for (i = 0; i < w; i++) {
		as += a[n[i] & 0xf];
		bs += b[n[i] & 0xf];
	}
	if (as > bs) as = bs;
	printf("%d\n", as);
	return 0;
}
0