首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Play the Dice(水期待DP)

2013-09-08 
Play the Dice(水期望DP)Play the DiceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65535/32768

Play the Dice(水期望DP)

Play the DiceTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 308    Accepted Submission(s): 136
Special Judge


Problem DescriptionInputOutputSample InputSample OutputSourceRecommend#include<iostream>#include<stdio.h>#include<math.h>#include<string.h>using namespace std;int a;int main(){ int i,n,m; double ans; while(~scanf("%d",&n)) { ans=0; for(i=0; i<n; i++) { scanf("%d",&a); ans+=a; } scanf("%d",&m); for(i=0; i<m; i++) scanf("%d",&a); if(ans==0)//必须这么写 printf("0.00\n"); else if(n==m)//n=m且ans不为0才为inf printf("inf\n"); else printf("%.2lf\n",ans/(n-m)); } return 0;}

热点排行