結果

問題 No.472 平均順位
ユーザー rtomprtomp
提出日時 2017-01-31 17:52:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 889 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 143,476 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-25 14:22:39
合計ジャッジ時間 2,364 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void Slove()’:
main.cpp:7:23: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define PF(f,v) printf(f,v)
                       ^
main.cpp:53:9: note: ‘ans’ was declared here
  double ans;
         ^~~

ソースコード

diff #

#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;
}
0