Submission #537805

#TimeUsernameProblemLanguageResultExecution timeMemory
537805Servus2022새로운 문제 (COCI19_akvizna)C++14
20 / 130
2 ms776 KiB
#include <bits/stdc++.h> using namespace std; const int NMAX = 105; long double dp[NMAX][NMAX]; int From[NMAX][NMAX]; int N, K; int main() { #ifdef HOME ifstream cin("date.in"); ofstream cout("date.out"); #endif // HOME cin>>N>>K; for (int i = 1; i <= N; ++ i ) for (int j = 1; j <= K; ++ j ) dp[i][j] = 0; for (int i = 1; i <= N; ++ i ) { dp[i][1] = 1; From[i][1] = i; } for (int j = 2; j <= K; ++ j ) { for (int i = 1; i <= N; ++ i ) { int X_Best = 0; for (int x = 0; x <= i; ++ x ) { long double pos_ans = (long double)(1.0*x / (1.0*i)) + dp[i-x][j-1]; if (pos_ans > dp[i][j]) { dp[i][j] = pos_ans; From[i][j] = x; } } } } cout<<fixed << setprecision(10)<<dp[N][K] << '\n'; /*for (int i = K; i >= 1; -- i ) { cout << From[N][i] << " "; N -= From[N][i]; }*/ return 0; }

Compilation message (stderr)

akvizna.cpp: In function 'int main()':
akvizna.cpp:27:17: warning: unused variable 'X_Best' [-Wunused-variable]
   27 |             int X_Best = 0;
      |                 ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...