zoukankan      html  css  js  c++  java
  • 【HDOJ5978】To begin or not to begin(概率)

    题意:有k个黑球和1个红球,两个轮流抽,抽到红球算赢,问先手赢的概率大还是后手大还是相等

    k<=1e5

    思路:手算前几项概率

    大胆猜想

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<string>
     4 #include<cmath>
     5 #include<iostream>
     6 #include<algorithm>
     7 #include<map>
     8 #include<set>
     9 #include<queue>
    10 #include<vector>
    11 using namespace std;
    12 typedef long long ll;
    13 typedef unsigned int uint;
    14 typedef unsigned long long ull;
    15 typedef pair<int,int> PII;
    16 typedef vector<int> VI;
    17 #define fi first
    18 #define se second 
    19 #define MP make_pair
    20 #define N   110000
    21 #define MOD 1000000007
    22 #define eps 1e-8 
    23 #define pi acos(-1)
    24 
    25 
    26 int n;
    27 
    28 int read()
    29 { 
    30    int v=0,f=1;
    31    char c=getchar();
    32    while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
    33    while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
    34    return v*f;
    35    
    36 }
    37 
    38 
    39 int main()
    40 {
    41     //freopen("H.in","r",stdin);
    42     //freopen("H.out","w",stdout);
    43     while(scanf("%d",&n)!=EOF)
    44     {
    45         if(n%2) printf("0
    ");
    46          else printf("1
    ");
    47     }
    48     return 0;
    49 }
  • 相关阅读:
    WPF Margin和Padding
    WPF Tab切换顺序设置
    WPF DataGrid DataGridTemplateColumn
    WPF CheckBox IsHitTestVisible
    WPF Tag
    WPF RadioButton
    WPF 用户控件(UserControl)
    WPF ToolTip
    Style Lessons in Clarity and Grace (11th Edition)中文翻译
    AI for AI
  • 原文地址:https://www.cnblogs.com/myx12345/p/9747656.html
Copyright © 2011-2022 走看看