結果
問題 | No.472 平均順位 |
ユーザー |
|
提出日時 | 2017-01-31 17:52:53 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 889 bytes |
コンパイル時間 | 2,076 ms |
コンパイル使用メモリ | 157,272 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 22:49:55 |
合計ジャッジ時間 | 2,576 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 1 WA * 15 |
コンパイルメッセージ
main.cpp: In function ‘void Slove()’: main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | #define SF(f,v) scanf(f,v) | ~~~~~^~~~~ main.cpp:20:9: note: in expansion of macro ‘SF’ 20 | SF("%d", &N); // コンテスト数 | ^~ main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | #define SF(f,v) scanf(f,v) | ~~~~~^~~~~ main.cpp:22:9: note: in expansion of macro ‘SF’ 22 | SF("%d", &P); // 回答数 | ^~ main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | #define SF(f,v) scanf(f,v) | ~~~~~^~~~~ main.cpp:38:27: note: in expansion of macro ‘SF’ 38 | REP(x, 3) SF("%d", &score[x]); | ^~
ソースコード
#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; }