結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-08 12:30:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,068 bytes |
| コンパイル時間 | 1,271 ms |
| コンパイル使用メモリ | 158,800 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 00:09:50 |
| 合計ジャッジ時間 | 2,156 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:19:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%d",&a[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:25:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | scanf("%d",&b[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv)
{
int N; //問題の個数
int i; //ループカウンタ
int a[100]; //問題のスコア
int b[100]; //問題が何番の人に解かれた
int total1 = 0; //始めに解けていない数
int total2 = 0; //始めに解けていない数
scanf("%d",&N);
//問題のスコアの入力
for(i = 0;i < N;i++)
{
scanf("%d",&a[i]);
}
//問題が何番の人に解かれたかの入力
for(i = 0;i < N;i++)
{
scanf("%d",&b[i]);
}
//始めに解けていない数と始めに解けていない数をカウント
for(i = 0;i < N;i++)
{
//自身が解いたスコア
if(b[i] == 0)
{
total1 += a[i];
}
//1位のスコア
else if (b[i] == 1)
{
total2 += a[i];
}
}
//1位のスコアと同じまたは、それ以上のスコアの場合
if(total1 > total2 || total1 == total2)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
return 0;
}