Skip to content

Commit c1c4732

Browse files
committed
Oct 2018
1 parent b89a6a8 commit c1c4732

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Codeforces/259A.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#AC
2+
import re
3+
4+
for i in range(8):
5+
s = input()
6+
if re.findall(r'(WW)|(BB)', s):
7+
print('NO')
8+
exit(0)
9+
10+
print('YES')

SPOJ/LOOPEXP.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* AC
2+
- The position of the maximum number is important.
3+
- Linearity of expectation.
4+
*/
5+
#include <bits/stdc++.h>
6+
7+
using namespace std;
8+
9+
int main()
10+
{
11+
long double dp[100001];
12+
dp[0] = 0;
13+
long double ans = 0;
14+
for (int n=1;n<=100000;n++)
15+
{
16+
dp [n] = (ans/n) + 1;
17+
ans += dp[n];
18+
}
19+
20+
int t;
21+
cin>>t;
22+
while(t--)
23+
{
24+
int n;
25+
cin>>n;
26+
cout<<fixed<<setprecision(9)<<dp[n]<<"\n";
27+
}
28+
}

0 commit comments

Comments
 (0)