結果
問題 |
No.216 FAC
|
ユーザー |
|
提出日時 | 2015-06-10 18:55:43 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 476 bytes |
コンパイル時間 | 298 ms |
コンパイル使用メモリ | 20,864 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-12 04:57:08 |
合計ジャッジ時間 | 1,455 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:9: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | fscanf(stdin, "%d", &n); | ^~~~~~~~~~~~~~~~~~~~~~~ main.c:9:17: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | fscanf(stdin, "%d", &a[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:12:17: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | fscanf(stdin, "%d", &b[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { int a[100], b[100], s[101]; int n, i, max = 0, k = 0; fscanf(stdin, "%d", &n); for(i = 0; i < n; i++) fscanf(stdin, "%d", &a[i]); for(i =0; i < n; i++) fscanf(stdin, "%d", &b[i]); for(i =0; i <= n; i++) s[i] = 0; for(i = 0; i < n; i++){ if(!(b[i])){ k += a[i]; }else{ s[b[i]] += a[i]; if(max < s[b[i]]) max = s[b[i]]; } } if(k >= max) printf("YES\n"); else printf("NO\n"); return 0; }