zoukankan      html  css  js  c++  java
  • 51nod 1381 硬币游戏 概率

    基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题
     收藏
     关注

    有一个简单但是很有趣的游戏。在这个游戏中有一个硬币还有一张桌子,这张桌子上有很多平行线(如下图所示)。两条相邻平行线之间的距离是1,硬币的半径是R,然后我们来抛硬币到桌子上,抛下之后硬币有时候会和一些直线相交(相切的情况也算是相交),有时候不会。

    请你来计算一下抛一次硬币之后,该硬币和直线相交数目的期望。


     
    Input
    第一行给出一个整数T,表示有T组数据(1<=T<=10000)。
    第2行到T+1,每行给出一个整数R。(0< R <= 10,000,000,000)
    Output
    对于每一个数据,在一行中输出答案的整数部分即可。
    Input示例
    1
    1
    Output示例
    2


    看例子猜的.....没想到就是*2
    #include <iostream>
    #include <cstring>
    #include <cstdio>
    #include <algorithm>
    #include <queue>
    #include <vector>
    #include <iomanip>
    #include <math.h>
    #include <map>
    using namespace std;
    #define FIN     freopen("input.txt","r",stdin);
    #define FOUT    freopen("output.txt","w",stdout);
    #define INF     0x3f3f3f3f
    #define INFLL   0x3f3f3f3f3f3f3f
    #define lson    l,m,rt<<1
    #define rson    m+1,r,rt<<1|1
    typedef long long LL;
    typedef pair<int, int> PII;
    
    int main() {
        //FIN
        int T;
        scanf("%d", &T);
        while(T--) {
            LL n;
            scanf("%lld", &n);
            printf("%lld
    ", n * 2);
        }
        return 0;
    }
    

      




  • 相关阅读:
    一些信息熵的含义
    scikit-learn包的学习资料
    DB Scan算法的分析与实现
    ps教程连接
    用PS如何把图片调出时尚杂志色
    Linux FIFO读写时堵塞与非堵塞的效果
    yuyv转yuv420p代码及验证代码
    YUV格式介绍
    too many include files depth = 1024错误原因
    开发用小工具
  • 原文地址:https://www.cnblogs.com/Hyouka/p/7278934.html
Copyright © 2011-2022 走看看