Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
double n;
cin>>n;
double t[n]={};
double v[n]={};
double ht=0;
double ot=0;
double x;
for(ll i=0; i<n; i++){
cin>>t[i];}
for(ll i=0; i<n; i++){
cin>>v[i];}
double dp[n][101]={{}};
dp[0][0]=0;
for(ll i=1; i<n; i++){
ht=v[i-1]; ot=v[i];
for(ll j=0; j<=ot; j++){
for(ll k=0; k<=ht; k++){
if(t[i]<abs(j-k))continue;
else{
x=(t[i]+j-k)/2;
dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
cout<<dp[n-1][0]<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   22 | double t[n]={};
      |          ^
a.cc:22:10: error: could not convert 'n' from 'double' to 'long unsigned int'
   22 | double t[n]={};
      |          ^
      |          |
      |          double
a.cc:22:10: error: size of array 't' has non-integral type 'double'
a.cc:23:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   23 | double v[n]={};
      |          ^
a.cc:23:10: error: could not convert 'n' from 'double' to 'long unsigned int'
   23 | double v[n]={};
      |          ^
      |          |
      |          double
a.cc:23:10: error: size of array 'v' has non-integral type 'double'
a.cc:31:11: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   31 | double dp[n][101]={{}};
      |           ^
a.cc:31:11: error: could not convert 'n' from 'double' to 'long unsigned int'
   31 | double dp[n][101]={{}};
      |           ^
      |           |
      |           double
a.cc:31:11: error: size of array 'dp' has non-integral type 'double'
a.cc:40:47: error: invalid operands of types 'double [1]' and 'double' to binary 'operator-'
   40 | dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
      |                                              ~^~
      |                                              | |
      |                                              | double
      |                                              double [1]
a.cc:40:55: error: invalid operands of types 'double [1]' and 'double' to binary 'operator-'
   40 | dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
      |                                                      ~^~
      |                                                      | |
      |                                                      | double
      |                                                      double [1]
a.cc:40:61: error: invalid operands of types 'double [1]' and 'double' to binary 'operator-'
   40 | dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
      |                                                            ~^~
      |                                                            | |
      |                                                            | double
      |                                                            double [1]
a.cc:41:9: error: invalid types 'double [1][101][double]' for array subscript
   41 | cout<<dp[n-1][0]<<endl;}
      |         ^