結果

問題 No.216 FAC
ユーザー くれちーくれちー
提出日時 2016-09-29 22:07:29
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 412 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 10:41:47
合計ジャッジ時間 1,126 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:8:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |                 scanf("%d", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d", &b[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main() {
	int n, a[100], b[100], no[101] = {}, k = 0, max, r, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (i = 0; i < n; i++) {
		scanf("%d", &b[i]);
		if (b[i] == 0) k += a[i];
		else no[b[i]] += a[i];
	}

	max = no[0];
	for (i = 1; i <= 100; i++) {
		if (no[i] > max) max = no[i];
	}
	if (k >= max) printf("YES\n");
	else printf("NO\n");

	return 0;
}
0