結果
| 問題 |
No.1478 Simple Sugoroku
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-04-16 22:27:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 526 bytes |
| コンパイル時間 | 952 ms |
| コンパイル使用メモリ | 75,816 KB |
| 最終ジャッジ日時 | 2025-01-20 20:11:18 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%lld%lld",&N,&M);
| ~~~~~^~~~~~~~~~~~~~~~~~
main.cpp:17:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | rep(i,M){ int a; scanf("%d",&a); A[i]=a; }
| ~~~~~^~~~~~~~~
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
ll N;
ll M;
vector<ll> A;
int main(){
scanf("%lld%lld",&N,&M);
A.resize(M);
rep(i,M){ int a; scanf("%d",&a); A[i]=a; }
double ans = N-1;
double sum = 0.0;
rep(i,M) sum += N-A[i];
rep(i,M-1){
sum -= N-A[i];
ans = min(ans, (double)M / (M-i-1) + sum / (M-i-1) + (A[0]-1));
}
printf("%.10f\n",ans);
return 0;
}
Nachia