結果
問題 | No.216 FAC |
ユーザー |
|
提出日時 | 2015-06-10 19:00:43 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 00:38:28 |
合計ジャッジ時間 | 1,082 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 <= 100; 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; }