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", n * 2);
    }
    return 0;
}

  




posted @ 2017-08-03 11:56  Hyouka  阅读(164)  评论(0编辑  收藏  举报