标签:http os io ar for 代码 sp amp on
http://acm.hdu.edu.cn/showproblem.php?pid=4802
今天心情不太好,因为跟一个学姐谈,她似乎保研有点被动,而我的条件其实不如她应该...祝她好运。刷道水题调整下心情
写的有点慢,因为没读题,直接看图,然后N P没考虑以及0/0的情况也没考虑,虽然1A,但是自己代码速度还可以,但是综合起来做题速度还是....
//#pragma comment(linker, "/STACK:102400000,102400000") #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <iostream> #include <iomanip> #include <cmath> #include <map> #include <set> #include <queue> using namespace std; #define ls(rt) rt*2 #define rs(rt) rt*2+1 #define ll long long #define ull unsigned long long #define rep(i,s,e) for(int i=s;i<e;i++) #define repe(i,s,e) for(int i=s;i<=e;i++) #define CL(a,b) memset(a,b,sizeof(a)) #define IN(s) freopen(s,"r",stdin) #define OUT(s) freopen(s,"w",stdout) const ll ll_INF = ((ull)(-1))>>1; const double EPS = 1e-8; const int INF = 100000000; int n; char mark[10]; double cal() { int len=strlen(mark); if(mark[0] == 'A') { if(len == 1)return 4.0; return 3.7; } if(mark[0] == 'B') { if(len == 1)return 3.0; if(mark[1] == '+')return 3.3; return 2.7; } if(mark[0] == 'C') { if(len == 1)return 2.0; if(mark[1]=='+')return 2.3; return 1.7; } if(mark[0] == 'D') { if(len == 1)return 1.3; return 1.0; } return 0.0; } int main() { double ans,cre,cc; while(~scanf("%d",&n)) { ans=cre=0; int flag=0; for(int i=0;i<n;i++) { scanf("%lf%s",&cc,mark); if(mark[0] == 'P' || mark[0]=='N')continue; flag=1; cre+=cc; ans+=cc*cal(); //printf("##%d %lf %lf\n",i,cc,cal()); } if(flag)printf("%.2lf\n",ans/cre); else puts("0.00"); } return 0; }
标签:http os io ar for 代码 sp amp on
原文地址:http://blog.csdn.net/u011026968/article/details/38983385