2012/03/07

Topcoder SRM 536(Div.1) Report


It's my first Div.1!

250-problem:This is same with Div.2 Hard. I submitted this with no problem. However, I think this problem is a little difficult for me.158.49pts.

500-problem: Basicly, I think output sum of the average of all dices. If we have dice which die is only 1, it's special case. However, there exists some other special case. I submitted this, but challenged.

Score=158.49, Standings=632nd. Rating 1200->1184. I can't solve Div.1 problems.

[Easy(C++),Accepted]



#include<iostream>
#include<vector>


using namespace std;


class MergersDivOne{
public:
double findMaximum(vector <int> revenues){
int i,j;
int tmp,n=revenues.size(),minpl;
double now;

for(i=0;i<n;i++){
minpl=i;
for(j=i+1;j<n;j++) if(revenues[minpl]>revenues[j]) minpl=j;
tmp=revenues[i];
revenues[i]=revenues[minpl];
revenues[minpl]=tmp;
}

now=revenues[0];
for(i=1;i<n;i++){
now+=revenues[i];
now/=2;
}
return now;
}
};


[Medium(C++),Challenged]



#include<iostream>
#include<vector>


using namespace std;


class RollingDiceDivOne{
public:
long long mostLikely(vector <int> dice){
int one_num=0,i,n=dice.size();
long double ave=0;
long long ret;
for(i=0;i<n;i++) one_num+=(dice[i]==1);
if(n-one_num==1) return (long long)n;

for(i=0;i<n;i++) ave+=0.5*(dice[i]+1);

ret=(long long)ave;
return ret;
}
};

0 件のコメント:

コメントを投稿