zoukankan      html  css  js  c++  java
  • 【模拟】NCPC 2014 D Dice Game

    题目链接:

      http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1790

    题目大意:

      两个人,每个人有两个骰子,每个骰子可以等概率取[a,b],问哪个人两个骰子期望和更大。

    题目思路:

      【模拟】

      签到水题。单个骰子的期望E=0.5*(b+a)。所以只需要求和比大小就行。

     1 //
     2 //by coolxxx
     3 //#include<bits/stdc++.h>
     4 #include<iostream>
     5 #include<algorithm>
     6 #include<string>
     7 #include<iomanip>
     8 #include<map>
     9 #include<stack>
    10 #include<queue>
    11 #include<set>
    12 #include<bitset>
    13 #include<memory.h>
    14 #include<time.h>
    15 #include<stdio.h>
    16 #include<stdlib.h>
    17 #include<string.h>
    18 //#include<stdbool.h>
    19 #include<math.h>
    20 #define min(a,b) ((a)<(b)?(a):(b))
    21 #define max(a,b) ((a)>(b)?(a):(b))
    22 #define abs(a) ((a)>0?(a):(-(a)))
    23 #define lowbit(a) (a&(-a))
    24 #define sqr(a) ((a)*(a))
    25 #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
    26 #define mem(a,b) memset(a,b,sizeof(a))
    27 #define eps (1e-8)
    28 #define J 10
    29 #define mod 1000000007
    30 #define MAX 0x7f7f7f7f
    31 #define PI 3.14159265358979323
    32 #define N 104
    33 using namespace std;
    34 typedef long long LL;
    35 int cas,cass;
    36 int n,m,lll,ans;
    37 int a,b,c,d;
    38 int main()
    39 {
    40     #ifndef ONLINE_JUDGE
    41 //    freopen("1.txt","r",stdin);
    42 //    freopen("2.txt","w",stdout);
    43     #endif
    44     int i,j,k;
    45 //    for(scanf("%d",&cass);cass;cass--)
    46 //    for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
    47 //    while(~scanf("%s",s+1))
    48     while(~scanf("%d",&n))
    49     {
    50         scanf("%d%d%d",&m,&cas,&cass);
    51         scanf("%d%d%d%d",&a,&b,&c,&d);
    52         ans=n+m+cas+cass;
    53         lll=a+b+c+d;
    54         if(ans==lll)puts("Tie");
    55         else if(ans<lll)puts("Emma");
    56         else puts("Gunnar");
    57     }
    58     return 0;
    59 }
    60 /*
    61 //
    62 
    63 //
    64 */
    View Code
  • 相关阅读:
    通用二进制格式安装、编译安装过程(以mysql为例)
    linux:网络
    深圳:软通-运维
    深圳:软通-python
    linux:用户管理
    linux:vim
    深圳:卡莱特-售前/售后服务
    linux:基本指令
    linux:安装
    电脑:磁盘扩容
  • 原文地址:https://www.cnblogs.com/Coolxxx/p/5827302.html
Copyright © 2011-2022 走看看