結果

問題 No.338 アンケート機能
ユーザー bal4u
提出日時 2019-04-15 14:51:39
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 30,464 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 07:54:19
合計ジャッジ時間 1,007 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:8:5: warning: conflicting types for built-in function 'round'; expected 'double(double)' [-Wbuiltin-declaration-mismatch]
    8 | int round(int a, int s)
      |     ^~~~~
main.c:5:1: note: 'round' is declared in header '<math.h>'
    4 | #include <stdio.h>
  +++ |+#include <math.h>
    5 | 

ソースコード

diff #

// yukicoder: No.338 アンケート機能
// 2019.4.15 bal4u

#include <stdio.h>

int tbl[201][201];

int round(int a, int s)
{
	int ans = a / s;
	if ((10 * a / s) % 10 >= 5) ans++;
	return ans;
}

int main()
{
	int a, b, A, B;

	for (a = 0; a <= 201; a++) for (b = 0; b <= 201; b++) if (a + b > 0) {
		A = round(100 * a, a + b), B = round(100 * b, a + b);
		if (tbl[A][B] == 0 || tbl[A][B] > a + b) tbl[A][B] = a + b;
	}
	scanf("%d%d", &A, &B);
	printf("%d\n", tbl[A][B]);
	return 0;
}
0