답안 #102951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102951 2019-03-28T08:20:44 Z mraron Akvizna (COCI19_akvizna) C++14
65 / 130
424 ms 66936 KB
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<62;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

double dp[3001][3001];

int main() {
	IO;
	int n,k;
	cin>>n>>k;
	dp[n][0]=0.0;
	for(int i=1;i<=k;++i) {
		for(int j=0;j<=n;++j) {
			for(int l=0;l<=n/i && j+l<=n;l++) {
				dp[j][i]=max(dp[j][i], dp[j+l][i-1]+(l>0?(double)l/(double)(j+l):0));
			}
		}
	}
	cout<<fixed<<setprecision(10);
	/*for(int i=0;i<=n;++i) {
		for(int j=0;j<=k;++j) {
			cout<<dp[i][j]<<" ";
		}cout<<"\n";
	}*/
	
	
	cout<<dp[0][k]<<"\n";
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 2 ms 768 KB Output is correct
3 Correct 4 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 768 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 768 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 19976 KB Output is correct
2 Correct 355 ms 48644 KB Output is correct
3 Correct 302 ms 59132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 193 ms 24184 KB Output is correct
2 Correct 317 ms 43708 KB Output is correct
3 Correct 397 ms 63968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 210 ms 21412 KB Output is correct
2 Correct 241 ms 31596 KB Output is correct
3 Correct 363 ms 59768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 223 ms 24204 KB Output is correct
2 Correct 418 ms 41460 KB Output is correct
3 Correct 419 ms 63068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 19964 KB Output is correct
2 Correct 280 ms 40176 KB Output is correct
3 Correct 259 ms 54964 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 134 ms 18672 KB Output is correct
2 Correct 273 ms 52188 KB Output is correct
3 Correct 362 ms 65912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 189 ms 19976 KB Output is correct
2 Correct 359 ms 52188 KB Output is correct
3 Correct 424 ms 66936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 171 ms 18916 KB Output is correct
2 Correct 313 ms 41064 KB Output is correct
3 Correct 305 ms 61976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 193 ms 23672 KB Output is correct
2 Correct 355 ms 44328 KB Output is correct
3 Correct 340 ms 64192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 412 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 412 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 528 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -