結果

問題 No.338 アンケート機能
ユーザー bal4u
提出日時 2019-04-15 14:48:52
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 30,336 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 07:54:18
合計ジャッジ時間 1,125 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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[101][101];

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 <= 100; a++) for (b = 0; b <= 100; 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