记录编号 122826 评测结果 AAAAAAAAAA
题目名称 [東方S2] 雾雨魔理沙 最终得分 100
用户昵称 GravatarHouJikan 是否通过 通过
代码语言 C++ 运行时间 0.064 s
提交时间 2014-09-24 17:01:21 内存使用 0.38 MiB
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <list>
#include <iterator>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <deque>
#define For(i,j,k) for(int i=(j);i<=(k);i++)
using namespace std;
typedef long long LL;
typedef unsigned int Uint;
const int INF=0x7fffffff;
const double eps=1e-6;
using namespace std;
//================struct declaration======================
struct stars
{
  int x,y;
  int value,mul;
};
//================var declaration=-========================
const int MAXN=2010;
int n;
double k;
int Mul[MAXN],Val[MAXN];
double f[MAXN];
stars star[MAXN];
//===========function declaration====================
bool cmp(stars a,stars b){return (a.y-(a.x*k))<(b.y-(b.x*k));}
//================main code===============================
int main()
{
  string ProgrammeName="marisa";
  string FloderName="COGS";
  freopen((ProgrammeName+".in").c_str(),"r",stdin);
  freopen((ProgrammeName+".out").c_str(),"w",stdout);
#ifdef DEBUG
  clock_t Start_Time=clock();
  system(("copy C:\\Users\\abc\\Desktop\\HouJikan\\"+FloderName+"\\standard.cpp C:\\Users\\abc\\Desktop\\HouJikan\\"+FloderName+"\\submit.txt").c_str());
#endif  
   scanf("%d",&n);
   For(i,1,n)
     scanf("%d%d%d%d",&star[i].x,&star[i].y,&star[i].value,&star[i].mul);
   scanf("%lf",&k);
   k=tan(k/360*2*3.1415926);
   sort(star+1,star+1+n,cmp);
   memset(Val,0,sizeof(Val));
   memset(Mul,0,sizeof(Mul));
   For(i,1,n)
   {
     Val[i]=Val[i-1]+star[i].value;
     Mul[i]=Mul[i-1]+star[i].mul;
     f[i]=0;
     For(j,1,i)
       f[i]=max(f[i],f[j-1]+double(Val[i]-Val[j-1])*(Mul[i]-Mul[j-1])/(i-j+1));
   }
   printf("%.3lf\n",f[n]);
#ifdef DEBUG
  clock_t End_Time=clock();
  printf("\n\nTime Used :%.6lf Ms\n",double(Start_Time-End_Time)/(-CLOCKS_PER_SEC));
#endif
  return 0;
}
//================function code===========================