結果
| 問題 | No.472 平均順位 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-01-31 17:52:53 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 889 bytes |
| 記録 | |
| コンパイル時間 | 1,534 ms |
| コンパイル使用メモリ | 173,868 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-29 20:48:21 |
| 合計ジャッジ時間 | 2,155 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 1 WA * 15 |
コンパイルメッセージ
main.cpp: In function 'void Slove()':
main.cpp:7:23: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
7 | #define PF(f,v) printf(f,v)
| ~~~~~~^~~~~
main.cpp:69:9: note: in expansion of macro 'PF'
69 | PF("%.12lf", ans);
| ^~
main.cpp:53:16: note: 'ans' was declared here
53 | double ans;
| ^~~
ソースコード
#include "bits/stdc++.h"
// マクロ群
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(n) REP(i,n)
#define SF(f,v) scanf(f,v)
#define PF(f,v) printf(f,v)
using namespace std;
// 引き当てよう文字列
const char got[2] = { 'R', 'L' };
static int score[4];
void Slove()
{
int N, P;
SF("%d", &N); // コンテスト数
SF("%d", &P); // 回答数
if (P == N * 3)
{
puts("1.0");
return;
}
int total = 0;
int min = 100000;
int minTotal = 100000;
int i;
REP(i,N)
{
REP(x, 3) SF("%d", &score[x]);
total += score[0];
if (score[0] < minTotal)
{
minTotal = score[0];
}
if (score[2] < min)
{
min = score[2];
}
}
double ans;
if (P == 0)
{
ans = total / N;
}
else if (P == 2)
{
ans = (minTotal + min) / 2.0 ;
}
else if (P > 2)
{
ans = (minTotal + 1) / 2.0;
}
PF("%.12lf", ans);
}
int main()
{
Slove();
return 0;
}