标签:splay src size none algorithm hid close str display
题目:https://vjudge.z180.cn/problem/LightOJ-1248#author=0
题意:掷骰子,每个面至少出现一次的投掷期望
题解:几何分布
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> //#include <unordered_map> //#include <unordered_set> //#include <bits/stdc++.h> //#define int long long #define pb push_back #define PII pair<int, int> #define mpr make_pair #define ms(a, b) memset((a), (b), sizeof(a)) #define x first #define y second typedef long long ll; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const int N = 1e6 + 7; using namespace std; int main(int argc, char const *argv[]) { int T; int Case = 0; scanf("%d", &T); while (T--) { int n; scanf("%d", &n); double s=0; for(int i=1;i<=n;i++){ s+=n*1.0/i; } printf("Case %d: ",++Case); printf("%.10lf\n",s); } return 0; }
标签:splay src size none algorithm hid close str display
原文地址:https://www.cnblogs.com/Are-you-ready/p/14866213.html