Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
9 values
p03043
#include <bits/stdc++.h> #define SORT(a) sort(a.begin(), a.end()) #define RSORT(a) sort(a.rbegin(), a.rend()) #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, start, end) for (int i = start; i < end; i++) #define ALL(a) a.begin(), a.end() #define MOD(a) a %= 1'000'000'007 using ll = long long; using namespace std; const int INF32 = 1'050'000'000; const long long INF64 = 4'000'000'000'000'000'000; const int MOD7 = 1'000'000'007; const int MOD9 = 1'000'000'009; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } void print() { std::cout << '\n'; } template <class H, class... T> void print(H &&head, T &&...args) { std::cout << head; sizeof...(args) == 0 ? std::cout << "" : std::cout << ' '; print(std::forward<T>(args)...); } template <class T> void print(std::vector<T> &v) { for (int i = 0; i < v.size(); i++) { std::cout << v[i]; i == v.size() - 1 ? std::cout << '\n' : std::cout << ' '; } } template <class T> void print(std::vector<std::vector<T>> &v) { for (int i = 0; i < v.size(); i++) { for (int j = 0; j < v[i].size(); j++) { std::cout << v[i][j]; j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' '; } } } void fprint() { std::cout << '\n'; } template <class H, class... T> void fprint(H &&head, T &&...args) { std::cout << std::fixed << std::setprecision(10) << head; sizeof...(args) == 0 ? std::cout << "" : std::cout << ' '; print(std::forward<T>(args)...); } int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; double ans = 0; REP(i, N) { double sum = 0; int time = (i + 1); int cnt = 0; while (time <= K) { time *= 2; cnt++; } sum = (1.0 / N) * pow(0.5, cnt); ans += sum; } fprint(ans); return 0; }
#include <bits/stdc++.h> #define SORT(a) sort(a.begin(), a.end()) #define RSORT(a) sort(a.rbegin(), a.rend()) #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, start, end) for (int i = start; i < end; i++) #define ALL(a) a.begin(), a.end() #define MOD(a) a %= 1'000'000'007 using ll = long long; using namespace std; const int INF32 = 1'050'000'000; const long long INF64 = 4'000'000'000'000'000'000; const int MOD7 = 1'000'000'007; const int MOD9 = 1'000'000'009; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } void print() { std::cout << '\n'; } template <class H, class... T> void print(H &&head, T &&...args) { std::cout << head; sizeof...(args) == 0 ? std::cout << "" : std::cout << ' '; print(std::forward<T>(args)...); } template <class T> void print(std::vector<T> &v) { for (int i = 0; i < v.size(); i++) { std::cout << v[i]; i == v.size() - 1 ? std::cout << '\n' : std::cout << ' '; } } template <class T> void print(std::vector<std::vector<T>> &v) { for (int i = 0; i < v.size(); i++) { for (int j = 0; j < v[i].size(); j++) { std::cout << v[i][j]; j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' '; } } } void fprint() { std::cout << '\n'; } template <class H, class... T> void fprint(H &&head, T &&...args) { std::cout << std::fixed << std::setprecision(10) << head; sizeof...(args) == 0 ? std::cout << "" : std::cout << ' '; print(std::forward<T>(args)...); } int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; double ans = 0; REP(i, N) { double sum = 0; int time = (i + 1); int cnt = 0; while (time < K) { time *= 2; cnt++; } sum = (1.0 / N) * pow(0.5, cnt); ans += sum; } fprint(ans); return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,038
861,039
u324303263
cpp
p03043
#include <bits/stdc++.h> #define SORT(a) sort(a.begin(), a.end()) #define RSORT(a) sort(a.rbegin(), a.rend()) #define REP(i, n) for (int i = 0; i < n; i++) #define RREP(i, n) for (int i = n; 0 <= i; i--) #define FOR(i, start, end) for (int i = start; i < end; i++) #define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step) #define RFOR(i, start, end) for (int i = start; end <= i; i--) #define ALL(a) a.begin(), a.end() #define MOD(a) a %= 1000000007 typedef long long ll; using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; double ans = 0; REP(i, N) { int now = i + 1; int cnt = 0; while (now < K) { now *= 2; cnt++; } ans += (1.0 / N) * pow(0.5, cnt); } std::cout << ans << '\n'; return 0; }
#include <bits/stdc++.h> #define SORT(a) sort(a.begin(), a.end()) #define RSORT(a) sort(a.rbegin(), a.rend()) #define REP(i, n) for (int i = 0; i < n; i++) #define RREP(i, n) for (int i = n; 0 <= i; i--) #define FOR(i, start, end) for (int i = start; i < end; i++) #define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step) #define RFOR(i, start, end) for (int i = start; end <= i; i--) #define ALL(a) a.begin(), a.end() #define MOD(a) a %= 1000000007 typedef long long ll; using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; double ans = 0; REP(i, N) { int now = i + 1; int cnt = 0; while (now < K) { now *= 2; cnt++; } ans += (1.0 / N) * pow(0.5, cnt); } std::cout << setprecision(10) << ans << '\n'; return 0; }
[ "expression.operation.binary.add" ]
861,040
861,041
u324303263
cpp
p03043
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; double rate = 0.0; for (int i = 1; i < n; i++) { double temp = 1.0 / double(n); int now = i; while (now < k) { now *= 2; temp /= 2.0; } rate += temp; } cout << setprecision(15) << rate << endl; return 0; }
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; double rate = 0.0; for (int i = 1; i <= n; i++) { double temp = 1.0 / double(n); int now = i; while (now < k) { now *= 2; temp /= 2.0; } rate += temp; } cout << setprecision(15) << rate << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
861,042
861,043
u947304300
cpp
p03043
#include <bits/stdc++.h> #define inf 0x3f3f3f3f #define pb push_back #define fi first #define se second using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef pair<int, int> pi; typedef vector<pair<int, int>> vpi; int n, k; void read() { cin >> n >> k; } void solve() { float sol = 0; for (int i = 0; i < n; ++i) { float temp = i + 1; int nr = 0; while (temp < k) temp *= 2, ++nr; sol += (1.0 / n) * (1.0 / (1 << nr)); } cout << fixed << setprecision(15) << endl << sol; } int main() { ios ::sync_with_stdio(false); cin.tie(nullptr); read(); solve(); return 0; }
#include <bits/stdc++.h> #define inf 0x3f3f3f3f #define pb push_back #define fi first #define se second using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef pair<int, int> pi; typedef vector<pair<int, int>> vpi; int n, k; void read() { cin >> n >> k; } void solve() { double sol = 0; for (int i = 0; i < n; ++i) { double temp = i + 1; int nr = 0; while (temp < k) temp *= 2, ++nr; sol += (1.0 / n) * (1.0 / (1 << nr)); } cout << fixed << setprecision(12) << sol; } int main() { ios ::sync_with_stdio(false); cin.tie(nullptr); read(); solve(); return 0; }
[ "variable_declaration.type.primitive.change", "literal.number.change", "io.output.change", "expression.operation.binary.remove" ]
861,052
861,050
u519883882
cpp
p03043
#include <algorithm> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { int point = i; double probability = 1.0 / N; while (point < K) { point *= 2; probability /= 2; } ans += probability; } printf("%.12f¥n ", ans); }
#include <algorithm> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { int point = i; double probability = 1.0 / N; while (point < K) { point *= 2; probability /= 2; } ans += probability; } printf("%.12f", ans); }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
861,053
861,054
u582357587
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double prob = 0.0; for (int i = 1; i <= n; i++) { int point = i; double p = 1.0; while (point < k) { point *= 2; p *= 0.5; } prob += p; } prob /= n; cout << prob << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double prob = 0.0; for (int i = 1; i <= n; i++) { int point = i; double p = 1.0; while (point < k) { point *= 2; p *= 0.5; } prob += p; } prob /= n; cout << setprecision(20) << prob << endl; }
[ "io.output.change" ]
861,069
861,070
u756514276
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main(void) { int N, K; cin >> N >> K; double win = 0; int times; int ii; for (int i = 1; i <= N; i++) { ii = i; times = 0; while (ii < K) { times += 1; ii *= 2; } win += 1 / pow(2, times); } cout << win / N << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(void) { int N, K; cin >> N >> K; double win = 0; int times; int ii; for (int i = 1; i <= N; i++) { ii = i; times = 0; while (ii < K) { times += 1; ii *= 2; } win += 1 / pow(2, times); } cout << setprecision(12) << win / N << endl; return 0; }
[ "io.output.change" ]
861,073
861,074
u636279017
cpp
p03043
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i < (int)(n); i++) #define REP(i, m, n) for (int i = (m); i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define mp make_pair #define pb push_back #define MOD 1000000007 #define INF (1e9) #define PI (acos(-1)) #define print(x) cout << x << endl #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline auto __lcm(T &a, T &b) { return a * b / __gcd(a, b); } int main() { int N, K; cin >> N >> K; // 方針:全探索 // K <= 10^5 < 2^20 より,O(N * 20)で全探索できる double per = 0; rep(i, N) { double tmp = 1; rep(j, 20) { if ((i + 1) * tmp > K) { per += (double)1 / N * 1 / tmp; break; } tmp *= 2; } } print(fixed << setprecision(12) << per); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i < (int)(n); i++) #define REP(i, m, n) for (int i = (m); i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define mp make_pair #define pb push_back #define MOD 1000000007 #define INF (1e9) #define PI (acos(-1)) #define print(x) cout << x << endl #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline auto __lcm(T &a, T &b) { return a * b / __gcd(a, b); } int main() { int N, K; cin >> N >> K; // 方針:全探索 // K <= 10^5 < 2^20 より,O(N * 20)で全探索できる double per = 0; rep(i, N) { double tmp = 1; rep(j, 20) { if ((i + 1) * tmp >= K) { per += (double)1 / N * 1 / tmp; break; } tmp *= 2; } } print(fixed << setprecision(12) << per); return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,083
861,084
u219508174
cpp
p03043
#include <algorithm> #include <cmath> #include <fstream> #include <iostream> #include <vector> using namespace std; int check(int a, int k) { int res = 0; while (a <= k) { a *= 2; res++; } return res; } int main(int argc, const char *argv[]) { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { int p = check(i, k); // cout<<p<< endl; ans += (double)(pow(1.0 / 2.0, p) / (double)n); } printf("%0.10f\n", ans); return 0; }
#include <algorithm> #include <cmath> #include <fstream> #include <iostream> #include <vector> using namespace std; int check(int a, int k) { int res = 0; while (a < k) { a *= 2; res++; } return res; } int main(int argc, const char *argv[]) { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double p = check(i, k); // cout<<p<< endl; ans += (double)(pow(1.0 / 2.0, p) / (double)n); } printf("%0.10f\n", ans); return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change", "variable_declaration.type.primitive.change" ]
861,087
861,088
u432194969
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; const int MOD = (int)1e9 + 7; int main() { int n, k; cin >> n >> k; double prob = 0.0; rep(i, n) { int point = i + 1; double buf = 1.0 / n; while (point < k) { point *= 2; buf /= 2; } prob += buf; } cout << (prob) << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; const int MOD = (int)1e9 + 7; int main() { int n, k; cin >> n >> k; double prob = 0.0; rep(i, n) { int point = i + 1; double buf = 1.0 / n; while (point < k) { point *= 2; buf /= 2; } prob += buf; } cout << setprecision(12) << (prob) << endl; }
[ "io.output.change" ]
861,089
861,090
u494379309
cpp
p03043
#include <algorithm> #include <algorithm> // sort #include <cmath> #include <iostream> #include <map> // pair #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; const ll mod = 1e9 + 7; int main() { ll n, k; long double sum = 0.0; cin >> n >> k; for (int i = 1; i <= n; i++) { for (int j = 0; j < mod; j++) { if (i * pow(2.0, (double)j) > k) { sum += 1 / pow(2.0, (double)j); break; } } } sum /= n; printf("%.10Lf", sum); }
#include <algorithm> #include <algorithm> // sort #include <cmath> #include <iostream> #include <map> // pair #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; const ll mod = 1e9 + 7; int main() { ll n, k; long double sum = 0.0; cin >> n >> k; for (int i = 1; i <= n; i++) { for (int j = 0; j < mod; j++) { if (i * pow(2.0, (double)j) >= k) { sum += 1 / pow(2.0, (double)j); break; } } } sum /= n; printf("%.10Lf", sum); }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,093
861,094
u276796245
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double sum = 0; for (int i = 1; i <= n; i++) { double ans = 1 / n; int now = i; while (now < k) { now *= 2; ans /= 2; } sum += ans; } printf("%.12f\n", sum); }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double sum = 0; for (int i = 1; i <= n; i++) { double ans = 1.0 / n; int now = i; while (now < k) { now *= 2; ans /= 2; } sum += ans; } printf("%.12f\n", sum); }
[ "literal.number.change", "expression.operation.binary.change" ]
861,101
861,102
u370447425
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; int K; cin >> K; double ans = 0; for (int i = 0; i < N; i++) { double H = 1; while ((i + 1) * H < K) H *= 2; H = 1 / H; ans += H; } printf("ans : %.12f", ans / N); }
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; int K; cin >> K; double ans = 0; for (int i = 0; i < N; i++) { double H = 1; while ((i + 1) * H < K) H *= 2; H = 1 / H; ans += H; } printf("%.12f", ans / N); }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
861,111
861,112
u281840563
cpp
p03043
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { long long n, k; long double sum = 0; cin >> n >> k; for (long long i = 1; i <= n; i++) { long long y = i, count1 = 0; long double d = 1; while ((y) < k) { y = y * 2; d = d * 1 / (pow(0.5, 1)); } sum = sum + (1 / (n * d)); } printf("%.9f\n", sum); }
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { long long n, k; double sum = 0; cin >> n >> k; for (long long i = 1; i <= n; i++) { long long y = i, count1 = 0; double d = 1; while ((y) < k) { y = y * 2; d = d * 1 / (pow(0.5, 1)); } sum = sum + (1 / (n * d)); } printf("%.9f\n", sum); }
[ "variable_declaration.type.narrow.change" ]
861,119
861,120
u188903786
cpp
p03043
#include <algorithm> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <random> #include <sstream> #include <string> #include <vector> #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define rep(i, n) REP(i, 0, n) using namespace std; #define INF 100000000 int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= k; ++i) { double tmp = 1.0 / n; int now = i; while (now < k) { now *= 2; tmp /= 2; } ans += tmp; } cout << setprecision(12) << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <random> #include <sstream> #include <string> #include <vector> #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define rep(i, n) REP(i, 0, n) using namespace std; #define INF 100000000 int main() { int n, k; cin >> n >> k; long double ans = 0; for (int i = 1; i <= n; ++i) { long double tmp = 1.0 / n; int now = i; while (now < k) { now *= 2; tmp /= 2; } ans += tmp; } cout << setprecision(12) << ans << endl; return 0; }
[ "variable_declaration.type.widen.change", "identifier.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
861,135
861,136
u419390395
cpp
p03043
#include <algorithm> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <random> #include <sstream> #include <string> #include <vector> #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define rep(i, n) REP(i, 0, n) using namespace std; #define INF 100000000 int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= k; ++i) { int tmp = 1.0 / n; int now = i; while (now < k) { now *= 2; tmp /= 2; } ans += tmp; } cout << setprecision(12) << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <random> #include <sstream> #include <string> #include <vector> #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define rep(i, n) REP(i, 0, n) using namespace std; #define INF 100000000 int main() { int n, k; cin >> n >> k; long double ans = 0; for (int i = 1; i <= n; ++i) { long double tmp = 1.0 / n; int now = i; while (now < k) { now *= 2; tmp /= 2; } ans += tmp; } cout << setprecision(12) << ans << endl; return 0; }
[ "variable_declaration.type.widen.change", "identifier.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "variable_declaration.type.primitive.change" ]
861,137
861,136
u419390395
cpp
p03043
#define _USE_NATH_DEFINES #include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define rep(i, n) REP(i, 0, n) using namespace std; #define INF 100000000 int main() { int a, b; cin >> a >> b; long double ret = 0; for (int i = 1; i <= a; ++i) { double tmp = 1.0 / a; int now = i; while (now < b) { now *= 2; tmp /= 2; } ret += tmp; } cout << ret << endl; return 0; }
#define _USE_NATH_DEFINES #include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define rep(i, n) REP(i, 0, n) using namespace std; #define INF 100000000 int main() { int a, b; cin >> a >> b; long double ret = 0; for (int i = 1; i <= a; ++i) { double tmp = 1.0 / a; int now = i; while (now < b) { now *= 2; tmp /= 2; } ret += tmp; } cout << setprecision(12) << ret << endl; return 0; }
[ "io.output.change" ]
861,138
861,139
u419390395
cpp
p03043
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <numeric> #include <string> using namespace std; int main() { int N, K; cin >> N >> K; double ret = 0; for (int i = 1; i <= N; i++) { double tmp = 1.0 / N; int now = i; while (now < K) { now *= 2; tmp /= 2; } ret += tmp; } cout << ret << endl; }
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <numeric> #include <string> using namespace std; int main() { int N, K; cin >> N >> K; double ret = 0; for (int i = 1; i <= N; i++) { double tmp = 1.0 / N; int now = i; while (now < K) { now *= 2; tmp /= 2; } ret += tmp; } cout << setprecision(12) << ret << endl; }
[ "io.output.change" ]
861,148
861,149
u661461084
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; double f(double K, double i, double n) { if (K < i) { // cout << n << endl; return n; } n++; f(K, i * 2, n); } int main() { // ifstream in("data1.txt"); // cin.rdbuf(in.rdbuf()); double N; double K; cin >> N >> K; double ans; for (double i = N; i >= 1; i--) { double tmp; double cl = f(K, i, 0); // cout << (double)i << endl; // cout << "cl " << cl << endl; // cout << N << endl; tmp = (1.0 / N) * pow(1.0 / 2.0, cl); // cout << tmp << endl; ans += tmp; } printf("%.12f\n", ans); }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; double f(double K, double i, int n) { if (K <= i) { return n; } n++; f(K, i * 2, n); } int main() { double N; double K; cin >> N >> K; double ans; for (double i = N; i >= 1; i--) { double tmp; double cl = f(K, i, 0); tmp = (1.0 / N) * pow(1.0 / 2.0, cl); ans += tmp; } printf("%.12f\n", ans); }
[ "variable_declaration.type.primitive.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,150
861,151
u154650168
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; double f(double K, double i, double n) { if (K < i) { // cout << n << endl; return n; } n++; f(K, i * 2, n); } int main() { // ifstream in("data1.txt"); // cin.rdbuf(in.rdbuf()); double N; double K; cin >> N >> K; double ans; for (double i = N; i >= 1; i--) { double tmp; double cl = f(K, i, 0); // cout << (double)i << endl; // cout << "cl " << cl << endl; // cout << N << endl; tmp = (1.0 / N) * pow(1.0 / 2.0, cl); // cout << tmp << endl; ans += tmp; } printf("%.12f\n", ans); }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; double f(double K, double i, double n) { if (K <= i) { return n; } n++; f(K, i * 2, n); } int main() { // ifstream in("data1.txt"); // cin.rdbuf(in.rdbuf()); double N; double K; cin >> N >> K; double ans; for (double i = N; i >= 1; i--) { double tmp; double cl = f(K, i, 0); tmp = (1.0 / N) * pow(1.0 / 2.0, cl); ans += tmp; } printf("%.12f\n", ans); }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,150
861,152
u154650168
cpp
p03043
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { int a = i; double p = 1.0 / n; while (a < k) a *= 2, p /= 2; ans += p; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { int a = i; double p = 1.0 / n; while (a < k) a *= 2, p /= 2; ans += p; } cout << setprecision(9) << ans << endl; return 0; }
[ "io.output.change" ]
861,155
861,156
u781095600
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ALL(x) (x).begin(), (x).end() const long long MOD = 1000000007; const long long INF = 1LL << 60; int main() { int N, K; scanf("%d%d", N, K); double ans = 0; for (int i = 1; i <= N; i++) { int Point = i; double rate = 1.0 / N; while (Point < K) { Point *= 2; rate *= 0.5; } ans += rate; } printf("%.12f\n", ans); }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ALL(x) (x).begin(), (x).end() const long long MOD = 1000000007; const long long INF = 1LL << 60; int main() { int N, K; scanf("%d%d", &N, &K); double ans = 0; for (int i = 1; i <= N; i++) { int Point = i; double rate = 1.0 / N; while (Point < K) { Point *= 2; rate *= 0.5; } ans += rate; } printf("%.12f\n", ans); }
[ "expression.operation.unary.reference.add" ]
861,159
861,160
u615258936
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double N; int K; cin >> N; cin >> K; double ans = 0; double syoki = 1 / N; for (int i = 1; i <= N; i++) { double an = 1; int p = i; while (p < K) { an = an * 0.5; p = p * 2; } an = an * syoki; ans = ans + an; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { double N; int K; cin >> N; cin >> K; double ans = 0; double syoki = 1 / N; for (int i = 1; i <= N; i++) { double an = 1; int p = i; while (p < K) { an = an * 0.5; p = p * 2; } an = an * syoki; ans = ans + an; } cout << setprecision(10) << ans << endl; return 0; }
[ "io.output.change" ]
861,161
861,162
u439333767
cpp
p03043
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double D; typedef vector<int> VI; typedef vector<ll> VL; typedef pair<int, int> PII; typedef pair<ll, ll> PLL; #define rd(x) scanf("%d", &x) #define rd2(x, y) scanf("%d %d", &x, &y) #define rl(x) scanf("%lld", &x) #define rl2(x, y) scanf("%lld %lld", &x, &y) #define wd(x) printf("%d", x) #define wd2(x, y) printf("%d %d", x, y) #define wl(x) printf("%lld", x) #define wl2(x, y) printf("%lld %lld", x, y) #define PC(x) putchar(x) #define GC() getchar() #define NL printf("\n") #define SP printf(" ") #define F first #define S second #define MP make_pair #define PB push_back #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define fr(i, s, e) for (int i = s; i < e; i++) #define frl(i, s, e) for (ll i = s; i < e; i++) #define frr(i, s, e) for (int i = s - 1; i >= e; i--) #define frv(i, a) for (int i = 0; i < (int)a.size(); i++) #define frvr(i, a) for (int i = a.size() - 1; i >= 0; i--) #define tr(i, a) for (typeof(a.begin()) i = a.begin(); i != a.end(); i++) #define mod 1000000007 #define maxn 100009 #define maxr 100009 int main() { int n, k; rd2(n, k); double ans = .0; fr(i, 1, n + 1) { // double temp=0; int x = i; double ct = 1.0; if (i < k) { while (x < k) { ct /= 2; x *= 2; } // ans+=(double)pow((double)0.5,ct); ans += ct; // cout<<(double)pow(0.5,ct)<<endl; } } // cout<<ans<<endl; printf("%.10f\n", (double)ans / n); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double D; typedef vector<int> VI; typedef vector<ll> VL; typedef pair<int, int> PII; typedef pair<ll, ll> PLL; #define rd(x) scanf("%d", &x) #define rd2(x, y) scanf("%d %d", &x, &y) #define rl(x) scanf("%lld", &x) #define rl2(x, y) scanf("%lld %lld", &x, &y) #define wd(x) printf("%d", x) #define wd2(x, y) printf("%d %d", x, y) #define wl(x) printf("%lld", x) #define wl2(x, y) printf("%lld %lld", x, y) #define PC(x) putchar(x) #define GC() getchar() #define NL printf("\n") #define SP printf(" ") #define F first #define S second #define MP make_pair #define PB push_back #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define fr(i, s, e) for (int i = s; i < e; i++) #define frl(i, s, e) for (ll i = s; i < e; i++) #define frr(i, s, e) for (int i = s - 1; i >= e; i--) #define frv(i, a) for (int i = 0; i < (int)a.size(); i++) #define frvr(i, a) for (int i = a.size() - 1; i >= 0; i--) #define tr(i, a) for (typeof(a.begin()) i = a.begin(); i != a.end(); i++) #define mod 1000000007 #define maxn 100009 #define maxr 100009 int main() { int n, k; rd2(n, k); double ans = .0; fr(i, 1, n + 1) { // double temp=0; int x = i; double ct = 1.0; // if(i<k) { while (x < k) { ct /= 2; x *= 2; } // ans+=(double)pow((double)0.5,ct); ans += ct; // cout<<(double)pow(0.5,ct)<<endl; } } // cout<<ans<<endl; printf("%.10f\n", (double)ans / n); return 0; }
[]
861,165
861,166
u431615124
cpp
p03043
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int MOD = 1e9 + 7; const int larg = 1e5; typedef pair<int, int> P; typedef long long ll; int main() { double N, K; double prob = 0; cin >> N >> K; for (int i = 1; i <= N; i++) { double temp = 1.0 / N; double now = i; while (now < K) { temp /= 2; now *= 2; } prob += temp; } cout << prob; }
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int MOD = 1e9 + 7; const int larg = 1e5; typedef pair<int, int> P; typedef long long ll; int main() { double N, K; double prob = 0; cin >> N >> K; for (int i = 1; i <= N; i++) { double temp = 1.0 / N; double now = i; while (now < K) { temp /= 2; now *= 2; } prob += temp; } cout << setprecision(10) << prob; }
[ "io.output.change" ]
861,167
861,168
u554988565
cpp
p03043
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author Joy */ #include <bits/stdc++.h> #define REP(i, N) for (int i = 0; i < (N); ++i) #define ALL(x) (x).begin(), (x).end() #define MOD 1000000007 #define PB push_back #define MP make_pair using namespace std; typedef long long ll; ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } class CDiceAndCoin { public: void solve(std::istream &in, std::ostream &out) { int N, K; in >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { double prob = 1.0 / N; int score = i; while (score < K) { score *= 2; prob /= 2.0; } ans += prob; } out << ans << '\n'; } }; int main() { CDiceAndCoin solver; std::istream &in(std::cin); std::ostream &out(std::cout); solver.solve(in, out); return 0; }
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author Joy */ #include <bits/stdc++.h> #define REP(i, N) for (int i = 0; i < (N); ++i) #define ALL(x) (x).begin(), (x).end() #define MOD 1000000007 #define PB push_back #define MP make_pair using namespace std; typedef long long ll; ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } class CDiceAndCoin { public: void solve(std::istream &in, std::ostream &out) { int N, K; in >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { double prob = 1.0 / N; int score = i; while (score < K) { score *= 2; prob /= 2.0; } ans += prob; } out << setprecision(12) << ans << '\n'; } }; int main() { CDiceAndCoin solver; std::istream &in(std::cin); std::ostream &out(std::cout); solver.solve(in, out); return 0; }
[ "expression.operation.binary.add" ]
861,177
861,178
u408053343
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; double prob; int score; for (int i = 1; i <= n; i++) { score = i; prob = 1.0 / n; while (score < k) { score *= 2; prob /= 2; } ans += prob; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; double prob; int score; for (int i = 1; i <= n; i++) { score = i; prob = 1.0 / n; while (score < k) { score *= 2; prob /= 2; } ans += prob; } // printf("%.12f\n",ans); cout << setprecision(12) << ans << endl; }
[ "io.output.change" ]
861,179
861,180
u045575753
cpp
p03043
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define sz(x) (int)((x).size()) #define endl '\n' #define x first #define y second #define int long long #define double long double #define all(a) (a).begin(), (a).end() #define ar vector #define vse(a) a.begin(), a.end() #ifdef LOCAL #define dbg(x) cout << #x << " = " << x << endl; #else #define dbg(x) #endif using namespace std; void solve(); signed main() { #ifdef LOCAL freopen("file1.txt", "r", stdin); freopen("file2.txt", "w", stderr); #endif srand(time(0)); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(15); solve(); } void solve() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; ++i) { int num = i, cnt = 0; while (num < k) { num *= 2; cnt++; } double cur = 1; for (int j = 0; j < cnt; ++j) { cur *= 0.5; } ans += (1 / n) * cur; } cout << ans << endl; }
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define sz(x) (int)((x).size()) #define endl '\n' #define x first #define y second #define int long long #define double long double #define all(a) (a).begin(), (a).end() #define ar vector #define vse(a) a.begin(), a.end() #ifdef LOCAL #define dbg(x) cout << #x << " = " << x << endl; #else #define dbg(x) #endif using namespace std; void solve(); signed main() { #ifdef LOCAL freopen("file1.txt", "r", stdin); freopen("file2.txt", "w", stderr); #endif srand(time(0)); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(15); solve(); } void solve() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; ++i) { int num = i, cnt = 0; while (num < k) { num *= 2; cnt++; } double cur = 1; for (int j = 0; j < cnt; ++j) { cur *= 0.5; } ans += (1 / (double)n) * cur; } cout << ans << endl; }
[ "type_conversion.add" ]
861,181
861,182
u157759251
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define INF 1000000007 #define double float #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) #define maxn 15 signed main() { int N, K; cin >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { double x = 0; if (i < K) { x = ceil(log2((double)(K) / (double)i)); } double a = (double)1 / (double)N * (double)pow((double)0.5, (double)x); ans += a; } cout << fixed << setprecision(20) << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define INF 1000000007 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) #define maxn 15 signed main() { int N, K; cin >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { double x = 0; if (i < K) { x = ceil(log2((double)(K) / (double)i)); } double a = (double)1 / (double)N * (double)pow((double)0.5, (double)x); ans += a; } cout << fixed << setprecision(12) << ans << endl; }
[ "literal.number.change", "io.output.change" ]
861,187
861,188
u568545273
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { int x = i; double y = 1 / N; while (x < K) { x *= 2; y /= 2.0; } ans += y; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double ans = 0; for (int i = 1; i <= N; i++) { int x = i; double y = 1 / N; while (x < K) { x *= 2; y /= 2.0; } ans += y; } cout << setprecision(15) << ans << endl; }
[ "io.output.change" ]
861,189
861,190
u835534008
cpp
p03043
#include <bits/stdc++.h> #include <iostream> using namespace std; int f(int x, int y) { if (x >= y) return 0; return 1 + f(x * 2, y); } int n, k, x, ans1, ans2; int main(void) { cin >> n >> k; x = f(1, k); ans2 = n * (1 << x); for (int i = 1; i <= n; i++) { ans1 += (1 << (x - f(i, k))); } cout << setprecision(10) << float(ans1) / float(ans2) << endl; }
#include <bits/stdc++.h> #include <iostream> using namespace std; int f(int x, int y) { if (x >= y) return 0; return 1 + f(x * 2, y); } int n, k, x, ans1, ans2; int main(void) { cin >> n >> k; x = f(1, k); ans2 = n * (1 << x); for (int i = 1; i <= n; i++) { ans1 += (1 << (x - f(i, k))); } cout << setprecision(10) << double(ans1) / double(ans2) << endl; }
[ "call.function.change", "io.output.change" ]
861,191
861,192
u050428930
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double sum = 0.0; int cnt = 0; for (double i = 1; i <= N; i++) { double now = i; while (now <= K) { now = now * 2; cnt++; } sum += (1.0 / N) * pow(0.5, cnt); cnt = 0; } cout << fixed << setprecision(12) << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double sum = 0; double cnt = 0; for (double i = 1; i <= N; i++) { int now = i; while (now < K) { now = now * 2; cnt++; } sum += (1.0 / N) * pow(0.5, cnt); cnt = 0; } cout << fixed << setprecision(12) << sum << endl; }
[ "literal.number.change", "variable_declaration.value.change", "variable_declaration.type.primitive.change", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,195
861,196
u764860452
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double sum = 0.0; double cnt = 0; for (double i = 1; i <= N; i++) { double now = i; while (now <= K) { now = now * 2; cnt++; } sum += (1.0 / N) * pow(0.5, cnt); cnt = 0; } cout << fixed << setprecision(20) << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double sum = 0; double cnt = 0; for (double i = 1; i <= N; i++) { int now = i; while (now < K) { now = now * 2; cnt++; } sum += (1.0 / N) * pow(0.5, cnt); cnt = 0; } cout << fixed << setprecision(12) << sum << endl; }
[ "literal.number.change", "variable_declaration.value.change", "variable_declaration.type.primitive.change", "expression.operator.compare.change", "control_flow.loop.condition.change", "io.output.change" ]
861,197
861,196
u764860452
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double sum = 0; double cnt = 0; for (int i = 1; i <= N; i++) { int now = i; while (now <= K) { now = now * 2; cnt++; } sum += (1.0 / N) * pow(0.5, cnt); cnt = 0; } cout << fixed << setprecision(20) << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double sum = 0; double cnt = 0; for (double i = 1; i <= N; i++) { int now = i; while (now < K) { now = now * 2; cnt++; } sum += (1.0 / N) * pow(0.5, cnt); cnt = 0; } cout << fixed << setprecision(12) << sum << endl; }
[ "control_flow.loop.for.initializer.change", "variable_declaration.type.primitive.change", "expression.operator.compare.change", "control_flow.loop.condition.change", "literal.number.change", "io.output.change" ]
861,198
861,196
u764860452
cpp
p03043
// abc139_b // #include <bits/stdc++.h> #include <cmath> #include <iomanip> #include <iostream> using namespace std; int main(void) { int N, K; cin >> N >> K; double sum = 0.0; for (int i = 1; i <= N; i++) { int t = i; double e = 0; while (t <= K) { t *= 2; e++; } // cout << i << "=" << e << endl; double prob = double(1 / (double)N) * pow(0.5, e); // cout << "prob=" << prob << endl; sum += prob; } cout << std::setprecision(12) << sum << endl; }
// abc139_b // #include <bits/stdc++.h> #include <cmath> #include <iomanip> #include <iostream> using namespace std; int main(void) { int N, K; cin >> N >> K; double sum = 0.0; for (int i = 1; i <= N; i++) { int t = i; double e = 0; while (t < K) { t *= 2; e++; } // cout << i << "=" << e << endl; double prob = double((double)1 / (double)N) * pow(0.5, e); // cout << "prob=" << prob << endl; sum += prob; } cout << std::setprecision(12) << sum << endl; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,202
861,203
u798557584
cpp
p03043
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { double n; double k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i++) { int score = i; double p = 1; while (score <= k) { score = score * 2; p *= 0.5; } ans += (1 / (n * 1.0)) * p; } // cout << ans << endl; printf("%.12f\n", ans); }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { double n; double k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i++) { int score = i; double p = 1; while (score < k) { score = score * 2; p *= 0.5; } ans += (1 / (n * 1.0)) * p; } // cout << ans << endl; printf("%.12f\n", ans); }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,209
861,210
u698571659
cpp
p03043
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { double n; double k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i++) { int score = i; double p = 1; while (score <= k) { score = score * 2; p *= 0.5; } ans += (1 / (n * 1.0)) * p; } // cout << ans << endl; printf("%f\n", ans); }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { double n; double k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i++) { int score = i; double p = 1; while (score < k) { score = score * 2; p *= 0.5; } ans += (1 / (n * 1.0)) * p; } // cout << ans << endl; printf("%.12f\n", ans); }
[ "expression.operator.compare.change", "control_flow.loop.condition.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
861,211
861,210
u698571659
cpp
p03043
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> #define ll long long int #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define FOREACH(x, a) for (auto &(x) : (a)) #define ALL(a) (a).begin(), (a).end() #define OUT(x) out << (x) << endl; #define M0(x) memset(x, 0, sizeof(x)) #define MINF(x) memset(x, 0x3f, sizeof(x)) #define MMINUS(a) memset(a, 0xff, sizeof(a)) #define ten(n) ((int)1e##n) const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const ll LINF = 1e18; const double EPS = 1.0 / LINF; const char ENDL = '\n'; // for JetBrains IDE only supports yen template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } using namespace std; //===================================== template //========================================================= int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, K; cin >> N >> K; double res = 0; for (int i = 1; i <= N; ++i) { double div = 1. * K / i; int n = div - EPS <= 1. ? 0. : (int)log2(div) + 1; res += 1. / N * pow(1. / 2, n); } cout << setprecision(15) << res << endl; }
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> #define ll long long int #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define FOREACH(x, a) for (auto &(x) : (a)) #define ALL(a) (a).begin(), (a).end() #define OUT(x) out << (x) << endl; #define M0(x) memset(x, 0, sizeof(x)) #define MINF(x) memset(x, 0x3f, sizeof(x)) #define MMINUS(a) memset(a, 0xff, sizeof(a)) #define ten(n) ((int)1e##n) const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const ll LINF = 1e18; const double EPS = 1.0 / LINF; const char ENDL = '\n'; // for JetBrains IDE only supports yen template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } using namespace std; //===================================== template //========================================================= int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, K; cin >> N >> K; double res = 0; for (int i = 1; i <= N; ++i) { double div = 1. * K / i; int n = div - EPS <= 1. ? 0. : ceil(log2(div)); res += 1. / N * pow(1. / 2, n); } cout << setprecision(15) << res << endl; }
[ "call.add", "expression.operation.binary.change" ]
861,212
861,213
u585670083
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int N, K; scanf("%d%d", &N, &K); double ans = 0; for (int i = 1; i <= N; i++) { // 現在の得点が既にK以上の場合、勝つ確率を計算し加える if (i >= K) { ans += (double)(1.0 / (double)N); continue; } int num_coin_wins = 0; for (int j = i; j <= K; j *= 2) { num_coin_wins++; } // コインの振る回数を考慮し、勝つ確率を計算し加える ans += ((double)(1.0 / (double)N)) * ((double)(1.0 / (double)pow(2, num_coin_wins))); } printf("%.16f", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N, K; scanf("%d%d", &N, &K); double ans = 0; for (int i = 1; i <= N; i++) { // 現在の得点が既にK以上の場合、勝つ確率を計算し加える if (i >= K) { ans += (double)(1.0 / (double)N); continue; } int num_coin_wins = 0; for (int j = i; j <= K - 1; j *= 2) { num_coin_wins++; } // コインの振る回数を考慮し、勝つ確率を計算し加える ans += ((double)(1.0 / (double)N)) * ((double)(1.0 / (double)pow(2, num_coin_wins))); } printf("%.12f", ans); return 0; }
[ "control_flow.loop.for.condition.change", "misc.off_by_one", "literal.string.change", "call.arguments.change", "io.output.change" ]
861,216
861,217
u553129408
cpp
p03043
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; #define big ((ll)(1e9) + 7) int main() { int n, k; cin >> n >> k; double ans = 0.0; // if(n > k) // { // vector<int> count; // for(int i = k-1;i >= 0;i--){ // count.push_back(i); // } // int num = 1; // int cn_z = 0; // while(true){ // for(int i = 0;i < count.size();i++){ // if(count[i]*2 >= k){ // ans += pow(0.5,num); // cout << num << endl; // count[i] = 0; // cn_z++; // } // else if(count[i] == 0) cn_z++; // else count[i] *= 2; // } // num++; // if(cn_z == count.size()) break; // cn_z = 0; // } // ans = n-ans; // ans /= n; // // cout << ans << endl; // cout << ans << endl; // printf("%.12f\n",ans); // } // else{ vector<int> count; for (int i = 1; i <= n; i++) { count.push_back(i); } int num = 1; int cn_z = 0; while (true) { for (int i = 0; i < count.size(); i++) { if (count[i] * 2 >= k) { ans += pow(0.5, num); // cout << num << endl; count[i] = 0; cn_z++; } else if (count[i] == 0) cn_z++; else count[i] *= 2; } num++; if (cn_z == count.size()) break; cn_z = 0; } ans /= n; // cout << ans << endl; printf("%.12f\n", ans); // } }
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; #define big ((ll)(1e9) + 7) int main() { int n, k; cin >> n >> k; double ans = 0.0; vector<int> count; for (int i = 1; i <= n; i++) { count.push_back(i); } int num = 0; int cn_z = 0; while (true) { for (int i = 0; i < count.size(); i++) { if (count[i] >= k) { ans += pow(0.5, num); count[i] = 0; cn_z++; } else if (count[i] == 0) cn_z++; else count[i] *= 2; } num++; if (cn_z == count.size()) break; cn_z = 0; } ans /= n; printf("%.12f\n", ans); }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
861,220
861,221
u115819033
cpp
p03043
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; #define big ((ll)(1e9) + 7) int main() { int n, k; cin >> n >> k; double ans = 0.0; // if(n > k) // { // vector<int> count; // for(int i = k-1;i >= 0;i--){ // count.push_back(i); // } // int num = 1; // int cn_z = 0; // while(true){ // for(int i = 0;i < count.size();i++){ // if(count[i]*2 >= k){ // ans += pow(0.5,num); // cout << num << endl; // count[i] = 0; // cn_z++; // } // else if(count[i] == 0) cn_z++; // else count[i] *= 2; // } // num++; // if(cn_z == count.size()) break; // cn_z = 0; // } // ans = n-ans; // ans /= n; // // cout << ans << endl; // cout << ans << endl; // printf("%.12f\n",ans); // } // else{ vector<int> count; for (int i = 1; i <= n; i++) { count.push_back(i); } int num = 1; int cn_z = 0; while (true) { for (int i = 0; i < count.size(); i++) { if (count[i] * 2 >= k) { ans += pow(0.5, num); // cout << num << endl; count[i] = 0; cn_z++; } else if (count[i] == 0) cn_z++; else count[i] *= 2; } num++; if (cn_z == count.size()) break; cn_z = 0; } ans /= n; // cout << ans << endl; printf("%.12f\n", ans); // } }
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; #define big ((ll)(1e9) + 7) int main() { int n, k; cin >> n >> k; double ans = 0.0; // if(n > k) // { // vector<int> count; // for(int i = k-1;i >= 0;i--){ // count.push_back(i); // } // int num = 1; // int cn_z = 0; // while(true){ // for(int i = 0;i < count.size();i++){ // if(count[i]*2 >= k){ // ans += pow(0.5,num); // cout << num << endl; // count[i] = 0; // cn_z++; // } // else if(count[i] == 0) cn_z++; // else count[i] *= 2; // } // num++; // if(cn_z == count.size()) break; // cn_z = 0; // } // ans = n-ans; // ans /= n; // // cout << ans << endl; // cout << ans << endl; // printf("%.12f\n",ans); // } // else{ vector<int> count; for (int i = 1; i <= n; i++) { count.push_back(i); } int num = 0; int cn_z = 0; while (true) { for (int i = 0; i < count.size(); i++) { if (count[i] >= k) { ans += pow(0.5, num); // cout << num << endl; count[i] = 0; cn_z++; } else if (count[i] == 0) cn_z++; else count[i] *= 2; } num++; if (cn_z == count.size()) break; cn_z = 0; } ans /= n; // cout << ans << endl; printf("%.12f\n", ans); // } }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
861,220
861,222
u115819033
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; double sum = 0; for (int i = 1; i <= N; i++) { int cnt = 0; int i_copy = i; while (i_copy < K) { i_copy *= 2; cnt++; } sum += pow(0.5, cnt); } sum /= N; cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; double sum = 0; for (int i = 1; i <= N; i++) { int cnt = 0; int i_copy = i; while (i_copy < K) { i_copy *= 2; cnt++; } sum += pow(0.5, cnt); } sum /= N; cout << setprecision(11) << sum << endl; return 0; }
[ "io.output.change" ]
861,231
861,232
u426572476
cpp
p03043
#include <cmath> #include <stdio.h> using namespace std; int main() { int n, k; scanf("%d %d", &n, &k); double ans = 0.0; for (int i = 1; i <= n; i++) { if (i >= k) { ans += 1.0 / n; } else { ans += pow(0.5, ceil(log2((double)(k / i)))) / n; } } printf("%.12f", ans); }
#include <cmath> #include <stdio.h> using namespace std; int main() { int n, k; scanf("%d %d", &n, &k); double ans = 0.0; for (int i = 1; i <= n; i++) { if (i >= k) { ans += 1.0 / n; } else { ans += pow(0.5, ceil(log2(k / (double)i))) / n; } } printf("%.12f", ans); }
[ "call.arguments.add", "call.arguments.change" ]
861,239
861,240
u652037179
cpp
p03043
#include <cmath> #include <cstdio> #include <iomanip> #include <iostream> using namespace std; int N, K; void solve() { double ans = 0.0; for (int i = 1; i < N + 1; i++) { if (i >= K) { ans += (double)1.0 / (double)N; } else { ans += (double)1.0 / (double)N * pow((double)1.0 / 2.0, ceil((double)log2((double)K / (double)i))); } } cout << ans << endl; } int main() { cin >> N >> K; solve(); }
#include <cmath> #include <cstdio> #include <iomanip> #include <iostream> using namespace std; int N, K; void solve() { double ans = 0.0; for (int i = 1; i < N + 1; i++) { if (i >= K) { ans += (double)1.0 / (double)N; } else { ans += (double)1.0 / (double)N * pow((double)1.0 / 2.0, ceil((double)log2((double)K / (double)i))); } } cout << setprecision(12) << ans << endl; } int main() { cin >> N >> K; solve(); }
[ "io.output.change" ]
861,241
861,242
u036744414
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) const long long mod = 1e9 + 7; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { int count = 0; int x = i; while (true) { if (x < k) { x = x << 1; count++; } else { break; } } ans += pow(0.5, count) / n; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) const long long mod = 1e9 + 7; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { int count = 0; int x = i; while (true) { if (x < k) { x = x << 1; count++; } else { break; } } ans += pow(0.5, count) / n; } cout << setprecision(12) << ans << endl; return 0; }
[ "io.output.change" ]
861,263
861,264
u207048881
cpp
p03043
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int N, K; double solve() { double result = 0; for (double num = 1; num <= N; num++) { double q; for (q = 0;; q++) if (pow(2, q) >= (double)K / num) break; result += pow(0.5, q); } return result * (1 / (double)N); } int main() { cin >> N >> K; printf("%lf\n", solve()); }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int N, K; double solve() { double result = 0; for (double num = 1; num <= N; num++) { double q; for (q = 0;; q++) if (pow(2, q) >= (double)K / num) break; result += pow(0.5, q); } return result * (1 / (double)N); } int main() { cin >> N >> K; printf("%.12lf\n", solve()); }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
861,271
861,272
u141938981
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int point = 0; int n, k; double sum = 0; scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { double tem = 1.0 / n; point = i; while (point < k) { point *= 2; tem /= 2; } sum += tem; } cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int point = 0; int n, k; double sum = 0; scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { double tem = 1.0 / n; point = i; while (point < k) { point *= 2; tem /= 2; } sum += tem; } cout << setprecision(12) << sum << endl; return 0; }
[ "io.output.change" ]
861,278
861,279
u616053863
cpp
p03043
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } return scanf("%.12f\n", ans); }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } printf("%.12f\n", ans); }
[ "function.return_value.change" ]
861,287
861,285
u379440427
cpp
p03043
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } return scanf("%.10lf\n", ans); }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } printf("%.12f\n", ans); }
[ "function.return_value.change", "literal.string.change", "call.arguments.change" ]
861,288
861,285
u379440427
cpp
p03043
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } return scanf("%.12lf\n", ans); }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } printf("%.12f\n", ans); }
[ "function.return_value.change", "literal.string.change", "call.arguments.change" ]
861,289
861,285
u379440427
cpp
p03043
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } scanf("%.12f\n", ans); }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; #define intv vector<v> #define llv vector<long long> #define intvv vector<vector<int>> #define llvv vector<vector<long long>> using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double temp = 1.0 / n; int j = i; while (j < k) { j *= 2; temp /= 2; } ans += temp; } printf("%.12f\n", ans); }
[ "identifier.change", "call.function.change" ]
861,290
861,285
u379440427
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double n, k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i++) { double count = 0; bool ok = true; int j = i; while (ok) { if (j < k) { j = j * 2; count++; } else if (j >= k) { double z = pow(0.5, count); ans = ans + 1 / n * z; ok = false; } } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { double n, k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i++) { double count = 0; bool ok = true; int j = i; while (ok) { if (j < k) { j = j * 2; count++; } else if (j >= k) { double z = pow(0.5, count); ans = ans + 1 / n * z; ok = false; } } } cout << setprecision(13) << ans << endl; return 0; }
[ "io.output.change" ]
861,297
861,298
u800100718
cpp
p03043
#include <bits/stdc++.h> using namespace std; struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } fast; int main() { int n, k, a; double prob = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { a = i; for (int j = 0; j <= 20; j++) { if (a > k) { prob = prob + (1.0 / n) * (1.0 / pow(2, j)); break; } a = a * 2; } } cout << prob << endl; }
#include <bits/stdc++.h> using namespace std; struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } fast; int main() { int n, k, a; double prob = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { a = i; for (int j = 0; j <= 20; j++) { if (a >= k) { prob = prob + (1.0 / n) * (1.0 / pow(2, j)); break; } a = a * 2; } } cout << prob << endl; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,299
861,300
u687204015
cpp
p03043
// g++ -I ~/Documents/programming/cppLib -std=gnu++14 -o test // ~/Documents/programming/cppLib/test.cpp && ./test && rm test #include <bits/stdc++.h> using namespace std; template <typename T> using vector2 = vector<vector<T>>; template <typename T> using vector3 = vector<vector2<T>>; template <typename T> using vector4 = vector<vector3<T>>; using lint = long long; #define FOR(i, a, b) for (lint i = (a); i < (b); ++i) #define REP(i, n) for (lint i = 0; i < (n); ++i) #define ALL(v) (v).begin(), (v).end() int main() { int N, K; cin >> N >> K; int count = 0; double prob = 0; for (int i = 1; i <= N; i++) { double prob_ = 1.0; for (int j = i; j < K; j *= 2) { prob_ /= 2; } prob += prob_; } cout << prob / N << endl; }
// g++ -I ~/Documents/programming/cppLib -std=gnu++14 -o test // ~/Documents/programming/cppLib/test.cpp && ./test && rm test #include <bits/stdc++.h> using namespace std; template <typename T> using vector2 = vector<vector<T>>; template <typename T> using vector3 = vector<vector2<T>>; template <typename T> using vector4 = vector<vector3<T>>; using lint = long long; #define FOR(i, a, b) for (lint i = (a); i < (b); ++i) #define REP(i, n) for (lint i = 0; i < (n); ++i) #define ALL(v) (v).begin(), (v).end() int main() { int N, K; cin >> N >> K; int count = 0; double prob = 0; for (int i = 1; i <= N; i++) { double prob_ = 1.0; for (int j = i; j < K; j *= 2) { prob_ /= 2; } prob += prob_; } cout << setprecision(20) << prob / N << endl; }
[ "io.output.change" ]
861,301
861,302
u151724181
cpp
p03043
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <stdio.h> #include <string> using namespace std; typedef long long ll; const double EPS = 1e-9; #define rep(i, n) for (int i = 0; i < n; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() float compute_prob(int K, int n) { double p = 1.0; while (n < K) { n *= 2; p *= 0.5; } return p; } int main(void) { int N, K; cin >> N >> K; double p = 0; For(n, 1, N + 1) { p += compute_prob(K, n) / N; } cout << std::setprecision(20) << p << endl; return 0; }
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <stdio.h> #include <string> using namespace std; typedef long long ll; const double EPS = 1e-9; #define rep(i, n) for (int i = 0; i < n; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() long double compute_prob(int K, int n) { long double p = 1.0; while (n < K) { n *= 2; p *= 0.5; } return p; } int main(void) { int N, K; cin >> N >> K; long double p = 0; For(n, 1, N + 1) { p += compute_prob(K, n) / N; } cout << std::setprecision(20) << p << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
861,303
861,304
u767543103
cpp
p03043
#include <bits/stdc++.h> using namespace std; int N, K; int main() { cin >> N >> K; int l = 1, h = N; float ans = 0; for (int i = 1; i <= N; i++) { int n = i; float r = 1; while (n < K) { r /= 2; n *= 2; } ans += r; } cout << std::setprecision(20) << ans / N << endl; }
#include <bits/stdc++.h> using namespace std; int N, K; int main() { cin >> N >> K; int l = 1, h = N; long double ans = 0; for (int i = 1; i <= N; i++) { int n = i; long double r = 1; while (n < K) { r /= 2; n *= 2; } ans += r; } cout << std::setprecision(20) << ans / N << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
861,307
861,308
u957084285
cpp
p03043
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int N, K, calc, cnt; cin >> N >> K; double ans; ans = 0; for (int i = 1; i <= N; i++) { calc = i; cnt = 0; while (calc < K) { calc = calc * 2; cnt++; } if (cnt == 0) { ans = ans * (1 / (double)N); } else { ans = ans + ((1 / (double)N) * (1 / pow(2, cnt))); } } cout << fixed << setprecision(12) << ans << endl; return 0; }
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int N, K, calc, cnt; cin >> N >> K; double ans; ans = 0; for (int i = 1; i <= N; i++) { calc = i; cnt = 0; while (calc < K) { calc = calc * 2; cnt++; } if (cnt == 0) { ans = ans + (1 / (double)N); } else { ans = ans + ((1 / (double)N) * (1 / pow(2, cnt))); } } cout << fixed << setprecision(12) << ans << endl; return 0; }
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
861,312
861,313
u752013826
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define ALL(obj) obj.begin(), obj.end() #define pb(obj) push_back(obj) #define REP(i, N) for (int i = 0; i < N; i++) typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); double N, K; cin >> N >> K; double sub = 0; for (int i = 1; i <= N; i++) { double a = i; double tmp = 1.0 / N; while (a < K) { a *= 2; tmp /= 2; } sub += tmp; } cout << sub << endl; }
#include <bits/stdc++.h> using namespace std; #define ALL(obj) obj.begin(), obj.end() #define pb(obj) push_back(obj) #define REP(i, N) for (int i = 0; i < N; i++) typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); double N, K; cin >> N >> K; double sub = 0; for (int i = 1; i <= N; i++) { double a = i; double tmp = 1.0 / N; while (a < K) { a *= 2; tmp /= 2; } sub += tmp; } cout << setprecision(12) << sub << endl; }
[ "io.output.change" ]
861,316
861,317
u892438699
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; long long p = 0; for (int i = 1; i <= n; i++) { /* code */ long long first = 1.0 / n; int sum = i; while (sum < k) { /* code */ sum *= 2; first /= 2.0; } p += first; } cout << setprecision(20) << p << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double p = 0; for (int i = 1; i <= n; i++) { /* code */ double first = 1.0 / n; int sum = i; while (sum < k) { /* code */ sum *= 2; first /= 2.0; } p += first; } cout << setprecision(20) << p << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.narrow.change" ]
861,318
861,319
u376859266
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; long long p = 0; for (int i = 1; i <= n; i++) { /* code */ long long first = 1.0 / n; int sum = i; while (sum < k) { /* code */ sum *= 2; first /= 2.0; } p += first; } cout << setprecision(10) << p << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double p = 0; for (int i = 1; i <= n; i++) { /* code */ double first = 1.0 / n; int sum = i; while (sum < k) { /* code */ sum *= 2; first /= 2.0; } p += first; } cout << setprecision(20) << p << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.narrow.change", "literal.number.change", "io.output.change" ]
861,320
861,319
u376859266
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double p = 0; for (int i = 1; i <= n; i++) { /* code */ double first = 1.0 / n; int sum = i; while (sum < k) { /* code */ sum *= 2; first /= 2.0; } p += first; } cout << p << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double p = 0; for (int i = 1; i <= n; i++) { /* code */ double first = 1.0 / n; int sum = i; while (sum < k) { /* code */ sum *= 2; first /= 2.0; } p += first; } cout << setprecision(20) << p << endl; }
[ "io.output.change" ]
861,321
861,319
u376859266
cpp
p03043
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i) #define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i) #define ALL(obj) (obj).begin(), (obj).end() using namespace std; using i64 = int64_t; using u64 = uint64_t; using vi = vector<int>; using vl = vector<i64>; using vd = vector<double>; using pi = pair<int, int>; using pl = pair<i64, i64>; using pd = pair<double, double>; constexpr int INF = 1 << 30; constexpr int MOD = 1000000007; template <typename T> void print(vector<T> &v) { REP(i, v.size()) { if (i) cout << " "; cout << v[i]; } cout << endl; } int main() { int n, k; cin >> n >> k; double ans = 0; FOR(i, 1, n + 1) { int score = i; double tmp = 1.0 / n; while (score < k) { score *= 2; tmp /= 2; } ans += tmp; } cout << ans << endl; }
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i) #define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i) #define ALL(obj) (obj).begin(), (obj).end() using namespace std; using i64 = int64_t; using u64 = uint64_t; using vi = vector<int>; using vl = vector<i64>; using vd = vector<double>; using pi = pair<int, int>; using pl = pair<i64, i64>; using pd = pair<double, double>; constexpr int INF = 1 << 30; constexpr int MOD = 1000000007; template <typename T> void print(vector<T> &v) { REP(i, v.size()) { if (i) cout << " "; cout << v[i]; } cout << endl; } int main() { int n, k; cin >> n >> k; double ans = 0; FOR(i, 1, n + 1) { int score = i; double tmp = 1.0 / n; while (score < k) { score *= 2; tmp /= 2; } ans += tmp; } cout << setprecision(10) << ans << endl; }
[ "io.output.change" ]
861,322
861,323
u220997159
cpp
p03043
/* Problem : https://atcoder.jp/contests/abc126/tasks/abc126_c Algorithm : math Status : */ #include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; int n, k; double ans; int main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { double tmp = 1.0 / (double)n; int x = i; while (x <= k) { tmp /= 2.0; x *= 2; } ans += tmp; } printf("%.12f\n", ans); return 0; }
/* Problem : https://atcoder.jp/contests/abc126/tasks/abc126_c Algorithm : math Status : */ #include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; int n, k; double ans; int main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { double tmp = 1.0 / (double)n; int x = i; while (x < k) { tmp /= 2.0; x *= 2; } ans += tmp; } printf("%.12f\n", ans); return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,324
861,325
u090150453
cpp
p03043
/* Problem : https://atcoder.jp/contests/abc126/tasks/abc126_c Algorithm : math Status : */ #include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; int n, k; double ans; int main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { double tmp = 1.0 / (double)n; int x = i; while (x <= k) { tmp /= 2.0; x *= 2; } ans += tmp; } printf("%.11f\n", ans); return 0; }
/* Problem : https://atcoder.jp/contests/abc126/tasks/abc126_c Algorithm : math Status : */ #include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; int n, k; double ans; int main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { double tmp = 1.0 / (double)n; int x = i; while (x < k) { tmp /= 2.0; x *= 2; } ans += tmp; } printf("%.12f\n", ans); return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
861,326
861,325
u090150453
cpp
p03043
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { long long n, k; long double sum, ans; ans = 0.0; cin >> n >> k; for (long long i = 1; i <= n; i++) { long double tmp = 1.0 / n; sum = i; while (sum <= k) { sum *= 2.0; tmp /= 2.0; } ans += tmp; } // cout << ans << endl; printf("%.14Lf\n", ans); }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { long long n, k; long double ans; ans = 0.0; cin >> n >> k; for (long long i = 1; i <= n; i++) { long double tmp = 1.0 / n; int sum = i; while (sum < k) { sum *= 2.0; tmp /= 2.0; } ans += tmp; } // cout << ans << endl; printf("%.12Lf\n", ans); }
[ "variable_declaration.remove", "expression.operator.compare.change", "control_flow.loop.condition.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
861,327
861,328
u607288620
cpp
p03043
#include <bits/stdc++.h> #define itn int #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int n; double k; cin >> n >> k; double ans = 0; rep(i, n) { int detame = i + 1; double kakuritu = 1; while (detame < k) { detame *= 2; kakuritu /= 2; } ans += kakuritu / k; } cout << fixed << setprecision(12) << ans << endl; }
#include <bits/stdc++.h> #define itn int #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int n; double k; cin >> n >> k; double ans = 0; rep(i, n) { int detame = i + 1; double kakuritu = 1; while (detame < k) { detame *= 2; kakuritu /= 2; } ans += kakuritu / n; } cout << fixed << setprecision(12) << ans << endl; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
861,329
861,330
u118875091
cpp
p03043
#include <bits/stdc++.h> #define itn int #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int n; double k; cin >> n >> k; double ans = 0; rep(i, n) { int detame = i + 1; double kakuritu = 1; while (detame < k) { detame *= 2; kakuritu /= 2; } ans += kakuritu / k; } cout << fixed << 12 << ans << endl; }
#include <bits/stdc++.h> #define itn int #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int n; double k; cin >> n >> k; double ans = 0; rep(i, n) { int detame = i + 1; double kakuritu = 1; while (detame < k) { detame *= 2; kakuritu /= 2; } ans += kakuritu / n; } cout << fixed << setprecision(12) << ans << endl; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "call.add", "call.arguments.change" ]
861,331
861,330
u118875091
cpp
p03043
#include <iostream> #include <string> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; double sum = 0; double temp; double p; for (int i = 1; i <= n; i++) { temp = 1.0 / n; p = i; while (p <= k) { p *= 2; temp /= 2; } sum += temp; } printf("%.12f\n", sum); return 0; }
#include <iostream> #include <string> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; double sum = 0; double temp; double p; for (int i = 1; i <= n; i++) { temp = 1.0 / n; p = i; while (p < k) { p *= 2; temp /= 2; } sum += temp; } printf("%.12f\n", sum); return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,332
861,333
u460737328
cpp
p03043
// https://atcoder.jp/contests/abc126/tasks/abc126_c #include <bits/stdc++.h> #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { double n, k; cin >> n >> k; double answer = 0.0; for (int i = 1; i <= n; i++) { double this_prob = 1.0 / n; int this_score = i; while (this_score < k) { this_score *= 2; this_prob /= 2; } answer += this_prob; } cout << answer << endl; return 0; }
// https://atcoder.jp/contests/abc126/tasks/abc126_c #include <bits/stdc++.h> #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { double n, k; cin >> n >> k; double answer = 0.0; for (int i = 1; i <= n; i++) { double this_prob = 1.0 / n; int this_score = i; while (this_score < k) { this_score *= 2; this_prob /= 2; } answer += this_prob; } cout << setprecision(12) << answer << endl; // printf("%.12f\n", answer); return 0; }
[ "io.output.change" ]
861,348
861,349
u673273726
cpp
p03043
// https://atcoder.jp/contests/abc126/tasks/abc126_c #include <bits/stdc++.h> #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { float n, k; cin >> n >> k; float answer = 0.0f; for (int i = 1; i <= n; i++) { float this_prob = 1.0 / n; int this_score = i; while (this_score < k) { this_score *= 2; this_prob /= 2; } answer += this_prob; } cout << setprecision(12) << answer << endl; return 0; }
// https://atcoder.jp/contests/abc126/tasks/abc126_c #include <bits/stdc++.h> #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { double n, k; cin >> n >> k; double answer = 0.0; for (int i = 1; i <= n; i++) { double this_prob = 1.0 / n; int this_score = i; while (this_score < k) { this_score *= 2; this_prob /= 2; } answer += this_prob; } cout << setprecision(12) << answer << endl; // printf("%.12f\n", answer); return 0; }
[ "variable_declaration.type.primitive.change" ]
861,350
861,349
u673273726
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--) #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(x) x.begin(), x.end() #define REVERSE(x) reverse(x.begin(), x.end()) typedef long long LL; const double INF = 1e9; int main() { int N, K; cin >> N >> K; double sum = 0; int i, j; FOR(i, 1, N + 1) { REP(j, 10000) { if (i * pow(2, j) > K) { sum += pow(0.5, j); break; } } } sum /= N; cout << setprecision(12) << sum << endl; }
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--) #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(x) x.begin(), x.end() #define REVERSE(x) reverse(x.begin(), x.end()) typedef long long LL; const double INF = 1e9; int main() { int N, K; cin >> N >> K; double sum = 0; int i, j; FOR(i, 1, N + 1) { REP(j, 10000) { if (i * pow(2, j) >= K) { sum += pow(0.5, j); break; } } } sum /= N; cout << setprecision(12) << sum << endl; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,351
861,352
u709810602
cpp
p03043
#include "bits/stdc++.h" using namespace std; int main() { long long N, K; cin >> N >> K; double answer = 0; for (int i = 0; i < N; i++) { long long score = i + 1; double tmp = 1; while (score < K) { tmp /= 2; score *= 2; } answer += tmp; } cout << setprecision(16) << answer << endl; }
#include "bits/stdc++.h" using namespace std; int main() { long long N, K; cin >> N >> K; double answer = 0; for (int i = 0; i < N; i++) { long long score = i + 1; double tmp = 1.0 / N; while (score < K) { tmp /= 2; score *= 2; } answer += tmp; } cout << setprecision(16) << answer << endl; }
[ "literal.number.change" ]
861,357
861,358
u422592877
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double sum = 0; for (int i = 1; i < n + 1; i++) { double d = 1.0 / n; for (int j = i; j < k; j *= 2) { d *= 0.5; } sum += d; } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; double sum = 0; for (int i = 1; i < n + 1; i++) { double d = 1.0 / n; for (int j = i; j < k; j *= 2) { d *= 0.5; } sum += d; } cout << setprecision(10) << sum << endl; }
[ "io.output.change" ]
861,361
861,362
u440248708
cpp
p03043
#include <iomanip> #include <iostream> using namespace std; int main() { int N, K, now; double c = 1, d = 0; cin >> N >> K; for (int i = 1; i <= N; i++) { now = i; while (now < K) { now *= 2; c /= 2; } d += c / N; c == 1; } cout << setprecision(12) << d; }
#include <iomanip> #include <iostream> using namespace std; int main() { int N, K, now; double c = 1, d = 0; cin >> N >> K; for (int i = 1; i <= N; i++) { now = i; while (now < K) { now *= 2; c /= 2; } d += c / N; c = 1; } cout << setprecision(12) << d; }
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
861,373
861,374
u220403681
cpp
p03043
#include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> using namespace std; int main() { int n, k, i = 1; double a, b, c; cin >> n >> k; a = 1 / (double)n; for (int i = 1; i <= n; i++) { int x = 0, p = i; while (p <= k) { p *= 2; x++; } c = pow(2, x); b += a * (1 / c); } cout << setprecision(12) << b << endl; }
#include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> using namespace std; int main() { int n, k, i = 1; double a, b, c; cin >> n >> k; a = 1 / (double)n; for (int i = 1; i <= n; i++) { int x = 0, p = i; while (p < k) { p *= 2; x++; } c = pow(2, x); b += a * (1 / c); } cout << setprecision(12) << b << endl; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,375
861,376
u454003145
cpp
p03043
#include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> using namespace std; int main() { int n, k, i = 1; double a, b, c; cin >> n >> k; a = 1 / (double)n; for (int i = 1; i <= n; i++) { int x = 0, p = i; while (p <= k) { p *= 2; x++; } c = pow(2, x); b += a * ((double)1 / c); } cout << setprecision(12) << b << endl; }
#include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> using namespace std; int main() { int n, k, i = 1; double a, b, c; cin >> n >> k; a = 1 / (double)n; for (int i = 1; i <= n; i++) { int x = 0, p = i; while (p < k) { p *= 2; x++; } c = pow(2, x); b += a * (1 / c); } cout << setprecision(12) << b << endl; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,377
861,376
u454003145
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double N, K; double sum = 0; cin >> N >> K; for (int i = 1; i <= N; i++) { int x = 0; //指数 int y = i; bool a = true; while (a) { if (y < K) { y *= 2; x++; } else { a = false; sum += (1.0 / N) * pow((1 / 2), x); } } } printf("%.12f", sum); }
#include <bits/stdc++.h> using namespace std; int main() { double N, K; double sum = 0; cin >> N >> K; for (int i = 1; i <= N; i++) { int x = 0; //指数 int y = i; bool a = true; while (a) { if (y < K) { y *= 2; x++; } else { a = false; sum += (1.0 / N) * pow((1.0 / 2.0), x); } } } printf("%.12f", sum); }
[ "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
861,382
861,383
u422506696
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const ll N = 1e5 + 5, MOD = 1e9 + 7; double n, k; double ans; ll power(ll x, ll y) { ll res = 1; while (y > 0) { if (y & 1) res *= x; y = y >> 1; x *= x; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; for (double i = 1; i <= n; i++) { double p = 1.0; double q = i; while (q < k) { q *= 2; p *= 0.5; } ans += p; } cout << fixed << setprecision(8) << ans / n << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define double long double const ll N = 1e5 + 5, MOD = 1e9 + 7; double n, k; double ans; ll power(ll x, ll y) { ll res = 1; while (y > 0) { if (y & 1) res *= x; y = y >> 1; x *= x; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; for (double i = 1; i <= n; i++) { double p = 1.0; double q = i; while (q < k) { q *= 2; p *= 0.5; } ans += p; } cout << fixed << setprecision(12) << ans / n << endl; return 0; }
[ "literal.number.change", "io.output.change" ]
861,390
861,391
u769602639
cpp
p03043
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double a = 1.0 / n; int tmp = i; while (tmp <= k) { tmp *= 2; a /= 2; } ans += a; } cout << fixed << setprecision(12) << ans << endl; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i <= n; i++) { double a = 1.0 / n; int tmp = i; while (tmp < k) { tmp *= 2; a /= 2; } ans += a; } cout << fixed << setprecision(12) << ans << endl; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,392
861,393
u479371430
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define rep(n) for (int i = 0; i < n; i += 1) #define prarr(a, n) rep(n) cout << a[i] << endl printf("%s\n", " "); #define sc(a) scanf("%d", &a); #define scl(a) scanf("%lld", &a); #define scf(a) ascanf("%f", &a); #define ff first #define ss second #define pu push_back #define inf 1000000001 #define MOD 1000000007 #define INF 100000000000001 int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i += 1) { if (i > k - 1) ans += 1.0 / n; else { int t = k / i; float a1 = 0.5; while (t > 1) { a1 *= 0.5; t /= 2; } ans += (1.0 / n) * a1; } } printf("%.20lf\n", ans); // cout<<ans<<endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define rep(n) for (int i = 0; i < n; i += 1) #define prarr(a, n) rep(n) cout << a[i] << endl printf("%s\n", " "); #define sc(a) scanf("%d", &a); #define scl(a) scanf("%lld", &a); #define scf(a) ascanf("%f", &a); #define ff first #define ss second #define pu push_back #define inf 1000000001 #define MOD 1000000007 #define INF 100000000000001 int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; double ans = 0; for (int i = 1; i < n + 1; i += 1) { if (i > k - 1) ans += 1.0 / n; else { int t = (k - 1) / i; float a1 = 0.5; while (t > 1) { a1 *= 0.5; t /= 2; } ans += (1.0 / n) * a1; } } printf("%.20lf\n", ans); // cout<<ans<<endl; return 0; }
[]
861,394
861,395
u943072121
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned long long #define lson l, mid, id << 1 #define rson mid + 1, r, id << 1 | 1 #define ls id << 1 #define rs id << 1 | 1 #define MID(l, r) (((l) + (r)) >> 1) const int MOD = (int)1e9 + 7; const double eps = (double)1e-8; const int maxn = (int)3e5 + 20; const double pi = (double)acos(-1.0); void work() { int n, k; cin >> n >> k; double ans = 0; double p = 1.0 / n; for (int i = 1; i <= n; i++) { double tmp = 1.0; int j = i; while (j < k) { tmp *= 0.5; j <<= 1; } ans += tmp; } printf("%.8f\n", ans * p); // cout <<ans <<endl; } int main() { #ifdef yukihana0416 freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); #endif // yukihana0416 int tc = 1; // scanf("%d", &tc); for (int ca = 1; ca <= tc; ca++) { // printf("Case #%d: ", ca); work(); } return 0; }
#include <bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned long long #define lson l, mid, id << 1 #define rson mid + 1, r, id << 1 | 1 #define ls id << 1 #define rs id << 1 | 1 #define MID(l, r) (((l) + (r)) >> 1) const int MOD = (int)1e9 + 7; const double eps = (double)1e-8; const int maxn = (int)3e5 + 20; const double pi = (double)acos(-1.0); void work() { int n, k; cin >> n >> k; double ans = 0; double p = 1.0 / n; for (int i = 1; i <= n; i++) { double tmp = 1.0; int j = i; while (j < k) { tmp *= 0.5; j <<= 1; } ans += tmp; } printf("%.12f\n", ans * p); // cout <<ans <<endl; } int main() { #ifdef yukihana0416 freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); #endif // yukihana0416 int tc = 1; // scanf("%d", &tc); for (int ca = 1; ca <= tc; ca++) { // printf("Case #%d: ", ca); work(); } return 0; }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
861,408
861,409
u682322833
cpp
p03043
#include <bits/stdc++.h> #include <sys/time.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define repi(i, a, b) \ for (long long i = (long long)(a); i < (long long)(b); i++) #define pb push_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define mt make_tuple #define mp make_pair template <class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template <class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>; ll ugauss(ll a, ll b) { if (!a) return 0; if (a > 0 ^ b > 0) return a / b; else return (a + (a > 0 ? -1 : 1)) / b + 1; } ll lgauss(ll a, ll b) { if (!a) return 0; if (a > 0 ^ b > 0) return (a + (a > 0 ? -1 : 1)) / b - 1; else return a / b; } template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) { o << "(" << v.first << ", " << v.second << ")"; return o; } template <size_t...> struct seq {}; template <size_t N, size_t... Is> struct gen_seq : gen_seq<N - 1, N - 1, Is...> {}; template <size_t... Is> struct gen_seq<0, Is...> : seq<Is...> {}; template <class Ch, class Tr, class Tuple, size_t... Is> void print_tuple(basic_ostream<Ch, Tr> &os, Tuple const &t, seq<Is...>) { using s = int[]; (void)s{0, (void(os << (Is == 0 ? "" : ", ") << get<Is>(t)), 0)...}; } template <class Ch, class Tr, class... Args> auto operator<<(basic_ostream<Ch, Tr> &os, tuple<Args...> const &t) -> basic_ostream<Ch, Tr> & { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; } ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; o << endl; } return o; } template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size() - 1 ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const deque<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size() - 1 ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const unordered_set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U> ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U, typename V> ostream &operator<<(ostream &o, const unordered_map<T, U, V> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]"; return o; } vector<int> range(const int x, const int y) { vector<int> v(y - x + 1); iota(v.begin(), v.end(), x); return v; } template <typename T> istream &operator>>(istream &i, vector<T> &o) { rep(j, o.size()) i >> o[j]; return i; } template <typename T, typename S, typename U> ostream &operator<<(ostream &o, const priority_queue<T, S, U> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " "; } return o; } template <typename T> ostream &operator<<(ostream &o, const queue<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.front(); tmp.pop(); o << x << " "; } return o; } template <typename T> ostream &operator<<(ostream &o, const stack<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " "; } return o; } template <typename T> unordered_map<T, ll> counter(vector<T> vec) { unordered_map<T, ll> ret; for (auto &&x : vec) ret[x]++; return ret; }; void vizGraph(vvll &g, int mode = 0, string filename = "out.png") { ofstream ofs("./out.dot"); ofs << "digraph graph_name {" << endl; set<P> memo; rep(i, g.size()) rep(j, g[i].size()) { if (mode && (memo.count(P(i, g[i][j])) || memo.count(P(g[i][j], i)))) continue; memo.insert(P(i, g[i][j])); ofs << " " << i << " -> " << g[i][j] << (mode ? " [arrowhead = none]" : "") << endl; } ofs << "}" << endl; ofs.close(); system(((string) "dot -T png out.dot >" + filename).c_str()); } struct timeval start; double sec() { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec - start.tv_sec) + (tv.tv_usec - start.tv_usec) * 1e-6; } size_t random_seed; struct init_ { init_() { ios::sync_with_stdio(false); cin.tie(0); gettimeofday(&start, NULL); struct timeval myTime; struct tm *time_st; gettimeofday(&myTime, NULL); time_st = localtime(&myTime.tv_sec); srand(myTime.tv_usec); random_seed = RAND_MAX / 2 + rand() / 2; } } init__; #define ldout fixed << setprecision(40) #define EPS (double)1e-14 #define INF (ll)1e18 #define mo (ll)(1e9 + 7) int main(void) { /* ll a=1; ll cnt=0; rep(i,100000){ a*=2; cnt++; cout<<a <<" " <<endl; if(a>100000) break; } cout <<cnt <<endl; */ ll n, k; cin >> n >> k; double ans = 0; repi(i, 1, n + 1) { if (i >= k) ans += (1.0 / n); else { double tmp = 1; ll cnt = i; rep(j, 17) { tmp *= 0.5; cnt *= 2; if (cnt > k) break; } ans += (1.0 / n) * tmp; } } cout << ldout << ans << endl; return 0; }
#include <bits/stdc++.h> #include <sys/time.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define repi(i, a, b) \ for (long long i = (long long)(a); i < (long long)(b); i++) #define pb push_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define mt make_tuple #define mp make_pair template <class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template <class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>; ll ugauss(ll a, ll b) { if (!a) return 0; if (a > 0 ^ b > 0) return a / b; else return (a + (a > 0 ? -1 : 1)) / b + 1; } ll lgauss(ll a, ll b) { if (!a) return 0; if (a > 0 ^ b > 0) return (a + (a > 0 ? -1 : 1)) / b - 1; else return a / b; } template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) { o << "(" << v.first << ", " << v.second << ")"; return o; } template <size_t...> struct seq {}; template <size_t N, size_t... Is> struct gen_seq : gen_seq<N - 1, N - 1, Is...> {}; template <size_t... Is> struct gen_seq<0, Is...> : seq<Is...> {}; template <class Ch, class Tr, class Tuple, size_t... Is> void print_tuple(basic_ostream<Ch, Tr> &os, Tuple const &t, seq<Is...>) { using s = int[]; (void)s{0, (void(os << (Is == 0 ? "" : ", ") << get<Is>(t)), 0)...}; } template <class Ch, class Tr, class... Args> auto operator<<(basic_ostream<Ch, Tr> &os, tuple<Args...> const &t) -> basic_ostream<Ch, Tr> & { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; } ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; o << endl; } return o; } template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size() - 1 ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const deque<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size() - 1 ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const unordered_set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U> ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U, typename V> ostream &operator<<(ostream &o, const unordered_map<T, U, V> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]"; return o; } vector<int> range(const int x, const int y) { vector<int> v(y - x + 1); iota(v.begin(), v.end(), x); return v; } template <typename T> istream &operator>>(istream &i, vector<T> &o) { rep(j, o.size()) i >> o[j]; return i; } template <typename T, typename S, typename U> ostream &operator<<(ostream &o, const priority_queue<T, S, U> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " "; } return o; } template <typename T> ostream &operator<<(ostream &o, const queue<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.front(); tmp.pop(); o << x << " "; } return o; } template <typename T> ostream &operator<<(ostream &o, const stack<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " "; } return o; } template <typename T> unordered_map<T, ll> counter(vector<T> vec) { unordered_map<T, ll> ret; for (auto &&x : vec) ret[x]++; return ret; }; void vizGraph(vvll &g, int mode = 0, string filename = "out.png") { ofstream ofs("./out.dot"); ofs << "digraph graph_name {" << endl; set<P> memo; rep(i, g.size()) rep(j, g[i].size()) { if (mode && (memo.count(P(i, g[i][j])) || memo.count(P(g[i][j], i)))) continue; memo.insert(P(i, g[i][j])); ofs << " " << i << " -> " << g[i][j] << (mode ? " [arrowhead = none]" : "") << endl; } ofs << "}" << endl; ofs.close(); system(((string) "dot -T png out.dot >" + filename).c_str()); } struct timeval start; double sec() { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec - start.tv_sec) + (tv.tv_usec - start.tv_usec) * 1e-6; } size_t random_seed; struct init_ { init_() { ios::sync_with_stdio(false); cin.tie(0); gettimeofday(&start, NULL); struct timeval myTime; struct tm *time_st; gettimeofday(&myTime, NULL); time_st = localtime(&myTime.tv_sec); srand(myTime.tv_usec); random_seed = RAND_MAX / 2 + rand() / 2; } } init__; #define ldout fixed << setprecision(40) #define EPS (double)1e-14 #define INF (ll)1e18 #define mo (ll)(1e9 + 7) int main(void) { /* ll a=1; ll cnt=0; rep(i,100000){ a*=2; cnt++; cout<<a <<" " <<endl; if(a>100000) break; } cout <<cnt <<endl; */ ll n, k; cin >> n >> k; double ans = 0; repi(i, 1, n + 1) { if (i >= k) ans += (1.0 / n); else { double tmp = 1; ll cnt = i; rep(j, 17) { tmp *= 0.5; cnt *= 2; if (cnt >= k) break; } ans += (1.0 / n) * tmp; } } cout << ldout << ans << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,413
861,414
u786453831
cpp
p03043
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <string> #include <vector> typedef long long ll; using namespace std; long double func1(long double a, long double b) { long double ret = 0; while (1) { if (a < b) { a = a * 2; ret++; } else break; } return ret; } int main(void) { long double n, k; cin >> n >> k; long double ans = 0; for (long double i = 1; i <= n; i++) { long double x = func1(i, 10); long double tmp = (1 / n) * pow((0.5), x); ans += tmp; } cout << setprecision(12) << ans << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <string> #include <vector> typedef long long ll; using namespace std; long double func1(long double a, long double b) { long double ret = 0; while (1) { if (a < b) { a = a * 2; ret++; } else break; } return ret; } int main(void) { long double n, k; cin >> n >> k; long double ans = 0; for (long double i = 1; i <= n; i++) { long double x = func1(i, k); long double tmp = (1 / n) * pow((0.5), x); ans += tmp; } cout << setprecision(12) << ans << endl; }
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
861,415
861,416
u180436681
cpp
p03043
#include <algorithm> #include <cmath> #include <cstdint> #include <iomanip> #include <iostream> #include <map> #include <set> #include <sstream> #include <string> #include <vector> int64_t v = std::pow(10, 10); int main(void) { int64_t n, k; std::cin >> n >> k; auto GetCount = [&](int64_t i) { int64_t count = 0; int64_t value = i; while (value < k) { value <<= 1; count++; } return std::pow(2, count); }; int64_t p = 0; for (int64_t i = 1; i <= n; ++i) { p += (1.0 * v) / (n * GetCount(i)); } double prob = (1.0 * p) / v; std::cout << std::setprecision(32) << prob << std::endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdint> #include <iomanip> #include <iostream> #include <map> #include <set> #include <sstream> #include <string> #include <vector> int64_t v = std::pow(10, 10); int main(void) { int64_t n, k; std::cin >> n >> k; auto GetCount = [&](int64_t i) { int64_t count = 0; int64_t value = i; while (value < k) { value <<= 1; count++; } return std::pow(2, count); }; double p = 0; for (int64_t i = 1; i <= n; ++i) { p += (1.0 * v) / (n * GetCount(i)); } double prob = (1.0 * p) / v; std::cout << std::setprecision(24) << prob << std::endl; return 0; }
[ "variable_declaration.type.primitive.change", "literal.number.change", "call.arguments.change", "expression.operation.binary.change" ]
861,419
861,420
u100280611
cpp
p03043
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; double base = 1 / (double)n; double cur = 2; double tot = 0; for (int i = n; i >= 1; i--) { if (i >= k) tot += base; else { while (i * cur <= k) { cur *= 2; } tot += base / cur; } } printf("%.20f\n", tot); return 0; }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; double base = 1 / (double)n; double cur = 2; double tot = 0; for (int i = n; i >= 1; i--) { if (i >= k) tot += base; else { while (i * cur < k) { cur *= 2; } tot += base / cur; } } printf("%.20f\n", tot); return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,421
861,422
u563397131
cpp
p03043
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; double base = 1 / (double)n; double cur = 2; double tot = 0; for (int i = n; i >= 1; i--) { if (i >= k) tot += base; else { if (i * cur <= k) cur *= 2; tot += base / cur; } } printf("%.20f\n", tot); return 0; }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; double base = 1 / (double)n; double cur = 2; double tot = 0; for (int i = n; i >= 1; i--) { if (i >= k) tot += base; else { while (i * cur < k) { cur *= 2; } tot += base / cur; } } printf("%.20f\n", tot); return 0; }
[ "control_flow.branch.while.replace.add", "control_flow.loop.if.replace.remove", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,423
861,422
u563397131
cpp
p03043
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) #define DSORT(c, type) sort(ALL(c), greater<type>()) #define MAX(v) *max_element(ALL(v)) #define MIN(v) *min_element(ALL(v)) #define SUM(v) accumulate(ALL(v), 0) #define AVE(v) SUM(v) / (v).size() // 入力eと同じ値の要素の数 #define COUNT(v, e) count(ALL(v), e) using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; double prob = 0; for (int d = 1; d <= n; ++d) { double p = 0; for (int c = 0;; ++c) { if (d * pow(2.0, c) >= k) { p += 1.0 / n * pow(0.5, c); break; } } prob += p; } cout << prob << endl; return 0; }
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) #define DSORT(c, type) sort(ALL(c), greater<type>()) #define MAX(v) *max_element(ALL(v)) #define MIN(v) *min_element(ALL(v)) #define SUM(v) accumulate(ALL(v), 0) #define AVE(v) SUM(v) / (v).size() // 入力eと同じ値の要素の数 #define COUNT(v, e) count(ALL(v), e) using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; double prob = 0; for (int d = 1; d <= n; ++d) { double p = 0; for (int c = 0;; ++c) { if (d * pow(2.0, c) >= k) { p += 1.0 / n * pow(0.5, c); break; } } prob += p; } cout << setprecision(13) << prob << endl; return 0; }
[ "io.output.change" ]
861,464
861,465
u952843849
cpp
p03043
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> II; typedef vector<II> VII; typedef vector<int> VI; typedef vector<VI> VVI; typedef long long int LL; #define PB push_back #define MP make_pair #define F first #define S second #define SZ(a) (int)(a.size()) #define ALL(a) a.begin(), a.end() #define SET(a, b) memset(a, b, sizeof(a)) #define si(n) scanf("%d", &n) #define dout(n) printf("%d\n", n) #define sll(n) scanf("%lld", &n) #define lldout(n) printf("%lld\n", n) #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #else #define trace(...) #endif #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define endl '\n' double prob[200000 + 10]; int main() { fast_io; int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { prob[i] = 1 / (1.0L * n); } double multi = 1.0; double ans = 0; for (int j = 1; j <= 40; j++) { for (int i = k; i <= 100000; i++) { ans += multi * prob[i]; prob[i] = 0; } for (int i = k - 1; i >= 1; i--) { prob[i * 2] = prob[i]; prob[i] = 0; } multi /= 2; } cout << fixed << setprecision(20) << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> II; typedef vector<II> VII; typedef vector<int> VI; typedef vector<VI> VVI; typedef long long int LL; #define PB push_back #define MP make_pair #define F first #define S second #define SZ(a) (int)(a.size()) #define ALL(a) a.begin(), a.end() #define SET(a, b) memset(a, b, sizeof(a)) #define si(n) scanf("%d", &n) #define dout(n) printf("%d\n", n) #define sll(n) scanf("%lld", &n) #define lldout(n) printf("%lld\n", n) #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #else #define trace(...) #endif #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define endl '\n' double prob[200000 + 10]; int main() { fast_io; int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { prob[i] = 1 / (1.0L * n); } double multi = 1.0; double ans = 0; for (int j = 1; j <= 40; j++) { for (int i = k; i <= 200000; i++) { ans += multi * prob[i]; prob[i] = 0; } for (int i = k - 1; i >= 1; i--) { prob[i * 2] = prob[i]; prob[i] = 0; } multi /= 2; } cout << fixed << setprecision(20) << ans << endl; return 0; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
861,474
861,475
u665172861
cpp
p03043
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> II; typedef vector<II> VII; typedef vector<int> VI; typedef vector<VI> VVI; typedef long long int LL; #define PB push_back #define MP make_pair #define F first #define S second #define SZ(a) (int)(a.size()) #define ALL(a) a.begin(), a.end() #define SET(a, b) memset(a, b, sizeof(a)) #define si(n) scanf("%d", &n) #define dout(n) printf("%d\n", n) #define sll(n) scanf("%lld", &n) #define lldout(n) printf("%lld\n", n) #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #else #define trace(...) #endif #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define endl '\n' double prob[100000 + 10]; int main() { fast_io; int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { prob[i] = 1 / (1.0l * n); } double multi = 1.0; double ans = 0; for (int j = 1; j <= 40; j++) { for (int i = k; i <= 100000; i++) { ans += multi * prob[i]; prob[i] = 0; } for (int i = k - 1; i >= 1; i--) { prob[i * 2] = prob[i]; prob[i] = 0; } multi /= 2; } cout << fixed << setprecision(20) << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> II; typedef vector<II> VII; typedef vector<int> VI; typedef vector<VI> VVI; typedef long long int LL; #define PB push_back #define MP make_pair #define F first #define S second #define SZ(a) (int)(a.size()) #define ALL(a) a.begin(), a.end() #define SET(a, b) memset(a, b, sizeof(a)) #define si(n) scanf("%d", &n) #define dout(n) printf("%d\n", n) #define sll(n) scanf("%lld", &n) #define lldout(n) printf("%lld\n", n) #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&...args) { const char *comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #else #define trace(...) #endif #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define endl '\n' double prob[200000 + 10]; int main() { fast_io; int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { prob[i] = 1 / (1.0L * n); } double multi = 1.0; double ans = 0; for (int j = 1; j <= 40; j++) { for (int i = k; i <= 200000; i++) { ans += multi * prob[i]; prob[i] = 0; } for (int i = k - 1; i >= 1; i--) { prob[i * 2] = prob[i]; prob[i] = 0; } multi /= 2; } cout << fixed << setprecision(20) << ans << endl; return 0; }
[ "literal.number.change", "expression.operation.binary.change", "assignment.value.change", "control_flow.loop.for.condition.change" ]
861,476
861,475
u665172861
cpp
p03043
#include <iomanip> #include <iostream> using namespace std; int main() { double n, k, ans = 0, p; cin >> n >> k; int i = 1, point = 1; for (p = 1.0 / n; i <= n; p = 1.0 / n, i++, point = i) { while (point < k) point <<= 1; p *= 1 / 2.0; ans += p; } cout << setprecision(15) << ans << endl; return 0; }
#include <iomanip> #include <iostream> using namespace std; int main() { double n, k, ans = 0, p; cin >> n >> k; int i = 1, point = 1; for (p = 1.0 / n; i <= n; p = 1.0 / n, i++, point = i) { while (point < k) point <<= 1, p *= 1 / 2.0; ans += p; } cout << setprecision(15) << ans << endl; return 0; }
[]
861,483
861,484
u612175324
cpp
p03043
#include <bits/stdc++.h> using namespace std; #define INFTY (1 << 30); typedef long long ll; int main(void) { ll N, K; double prob = 0.0; cin >> N >> K; for (int i = 1; i <= N; i++) { if (i >= K) { prob += (1.0 / (double)N) * ((double)N - (double)i + 1.0); break; } double res_log = (double)log2((double)K / (double)i); double res_ceil = ceil((double)res_log); // cout << i << " " << K << " " << res_log << " " << res_ceil << endl; prob += (pow(0.5, res_ceil) / N); } cout << prob << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define INFTY (1 << 30); typedef long long ll; int main(void) { ll N, K; double prob = 0.0; cin >> N >> K; for (int i = 1; i <= N; i++) { if (i >= K) { prob += (1.0 / (double)N) * ((double)N - (double)i + 1.0); break; } double res_log = (double)log2((double)K / (double)i); double res_ceil = ceil((double)res_log); // cout << i << " " << K << " " << res_log << " " << res_ceil << endl; prob += (pow(0.5, res_ceil) / N); } cout << setprecision(20) << prob << endl; return 0; }
[ "io.output.change" ]
861,490
861,491
u869091859
cpp
p03043
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; long double xyz(int n) { long double ans = 1; for (int i = 0; i < n; i++) { ans /= 2.0; } return ans; } int abc(int n, int k) { int tmp = n; int cnt = 0; while (tmp <= k) { tmp *= 2; cnt++; } return cnt; } int main() { int n, k; cin >> n >> k; long double ans = 0.0; for (int i = 1; i <= n; i++) { ans += xyz(abc(i, k)); } ans /= (double)n; cout << setprecision(12) << ans << endl; return 0; }
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; long double xyz(int n) { long double ans = 1; for (int i = 0; i < n; i++) { ans /= 2.0; } return ans; } int abc(int n, int k) { int tmp = n; int cnt = 0; while (tmp < k) { tmp *= 2; cnt++; } return cnt; } int main() { int n, k; cin >> n >> k; long double ans = 0.0; for (int i = 1; i <= n; i++) { ans += xyz(abc(i, k)); } ans /= (double)n; cout << setprecision(12) << ans << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,508
861,509
u419383010
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double p = 1.0 / N; double sum = 0; for (double i = 1; i <= N; i++) { for (double j = 1; j < 20; j++) { if (i * pow(2.0, j) > K) { sum += p * pow(2.0, -j); break; } } } printf("%.10f\n", sum); }
#include <bits/stdc++.h> using namespace std; int main() { double N, K; cin >> N >> K; double p = 1.0 / N; double sum = 0; for (double i = 1; i <= N; i++) { for (double j = 0; j < 20; j++) { if (i * pow(2.0, j) >= K) { sum += p * pow(2.0, -j); break; } } } printf("%.10f\n", sum); }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
861,512
861,513
u413492096
cpp
p03043
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 2e9; int main() { int n, k; ll ans = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { ll a = 1000000000000 / n; int score = i; while (score <= k - 1) { score *= 2; a /= 2; } ans += a; } cout << setprecision(12) << (double)ans / 1000000000000 << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 2e9; int main() { int n, k; ll ans = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { ll a = 1000000000000000 / n; int score = i; while (score <= k - 1) { score *= 2; a /= 2; } ans += a; } cout << setprecision(15) << (double)ans / 1000000000000000 << endl; }
[ "literal.number.change", "expression.operation.binary.change", "io.output.change" ]
861,514
861,515
u193591892
cpp
p03043
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 2e9; int main() { int n, k; ll ans = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { ll a = 1000000000 / n; int score = i; while (score <= k - 1) { score *= 2; a /= 2; } ans += a; } cout << setprecision(10) << (double)ans / 1000000000 << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 2e9; int main() { int n, k; ll ans = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { ll a = 1000000000000000 / n; int score = i; while (score <= k - 1) { score *= 2; a /= 2; } ans += a; } cout << setprecision(15) << (double)ans / 1000000000000000 << endl; }
[ "literal.number.change", "expression.operation.binary.change", "io.output.change" ]
861,516
861,515
u193591892
cpp
p03043
//------------------------------------------ // include //------------------------------------------ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> using namespace std; //------------------------------------------ // typedef //------------------------------------------ typedef long long LL; typedef vector<int> VI; typedef vector<bool> VB; typedef vector<char> VC; typedef vector<double> VD; typedef vector<string> VS; typedef vector<LL> VLL; typedef vector<VI> VVI; typedef vector<VB> VVB; typedef vector<VS> VVS; typedef vector<VLL> VVLL; typedef vector<VVI> VVVI; typedef vector<VVLL> VVVLL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<int, string> PIS; typedef pair<string, int> PSI; typedef pair<string, string> PSS; typedef vector<PII> VPII; typedef vector<PLL> VPLL; typedef vector<VPII> VVPII; typedef vector<VPLL> VVPLL; typedef vector<VS> VVS; //------------------------------------------ // comparison //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define CHMIN(a, b) a = min((a), (b)) #define CHMAX(a, b) a = max((a), (b)) #define C_ABS(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) //------------------------------------------ // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, arr) \ for (typeof((arr).begin()) i = (arr).begin(); i != (arr).end(); ++i) #define EXIST(str, e) ((str).find(e) != (str).end()) #define COUNT(arr, v) count((arr).begin(), (arr).end(), v) #define SEARCH(v, w) search((v).begin(), (v).end(), (w).begin(), (w).end()) #define B_SEARCH(arr, v) binary_search((arr).begin(), (arr).end(), v) #define SORT(c) sort((c).begin(), (c).end()) #define RSORT(c) sort((c).rbegin(), (c).rend()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ROTATE_LEFT(arr, c) \ rotate((arr).begin(), (arr).begin() + (c), (arr).end()) #define ROTATE_RIGHT(arr, c) \ rotate((arr).rbegin(), (arr).rbegin() + (c), (arr).rend()) #define SUMI(arr) accumulate((arr).begin(), (arr).end(), 0) #define SUMD(arr) accumulate((arr).begin(), (arr).end(), 0.) #define SUMLL(arr) accumulate((arr).begin(), (arr).end(), 0LL) #define SUMS(arr) accumulate((arr).begin(), (arr).end(), string()) #define UB(arr, n) upper_bound((arr).begin(), (arr).end(), n) #define LB(arr, n) lower_bound((arr).begin(), (arr).end(), n) #define OF_ALL(arr, func) all_of((arr).begin(), (arr).end(), (func)) #define OF_NONE(arr, func) none_of((arr).begin(), (arr).end(), (func)) #define OF_ANY(arr, func) any_of((arr).begin(), (arr).end(), (func)) #define PB push_back #define MP make_pair //------------------------------------------ // input output //------------------------------------------ #define GL(s) getline(cin, (s)) #define INIT() \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); #define OUT(d) std::cout << (d) #define OUT_L(d) std::cout << (d) << endl #define FOUT(n, data) std::cout << std::fixed << std::setprecision(n) << (data) #define FOUT_L(n, data) \ std::cout << std::fixed << std::setprecision(n) << (data) << "\n" #define EL() printf("\n") #define SHOW_VECTOR(v) \ { \ std::cerr << #v << "\t:"; \ for (const auto &xxx : v) { \ std::cerr << xxx << " "; \ } \ std::cerr << "\n"; \ } #define SHOW_MAP(v) \ { \ std::cerr << #v << endl; \ for (const auto &xxx : v) { \ std::cerr << xxx.first << " " << xxx.second << "\n"; \ } \ } #define Yes() printf("Yes\n") #define No() printf("No\n") #define YES() printf("YES\n") #define NO() printf("NO\n") //------------------------------------------ // repetition //------------------------------------------ #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define FORLL(i, a, b) for (LL i = LL(a); i < LL(b); ++i) #define RFORLL(i, a, b) for (LL i = LL(b) - 1; i >= LL(a); --i) #define REPLL(i, n) for (LL i = 0; i < LL(n); ++i) #define RREPLL(i, n) for (LL i = LL(n) - 1; i >= 0; --i) #define FOREACH(x, arr) for (auto &(x) : (arr)) #define FORITER(x, arr) for (auto(x) = (arr).begin(); (x) != (arr).end(); ++(x)) //************************************** //最大公約数 //************************************** template <class T> inline T GCD(const T x, const T y) { if (x < 0) return GCD(-x, y); if (y < 0) return GCD(x, -y); return (!y) ? x : GCD(y, x % y); } //************************************** // nの約数 //************************************** template <typename T> vector<T> DIVISOR(T n) { vector<T> v; for (LL i = 1; i * i <= n; ++i) { if (n % i == 0) { v.push_back(i); if (i != n / i) { v.push_back(n / i); } } } sort(v.begin(), v.end()); return v; } //------------------------------------------ // global //------------------------------------------ // int A = 0; VLL A; // int B = 0; LL B = 0; LL C = 0; LL D = 0; LL E = 0; LL G = 0; LL N = 0; LL M = 0; LL K = 0; LL T = 0; LL R = 0; VLL V; LL W = 0; LL Q = 0; string S = ""; VPLL Pair; LL i, j, k = 0; VLL Array; VC t; /* std::string str[3]; int h[100] = {0}; int h_size = 0; int MinCount = 0; LL i,j,k = 0; LL ans1,ans2 = 0; VLL A; LL K; LL K_pow = 0; LL K_num = 1; LL tmp = 0; */ //------------------------------------------ // read //------------------------------------------ void read(void) { cin >> N >> K; /* A.resize(N); REP(i, N) { cin >> A[i]; } */ } int main() { double ans = 0; double sum = 0; LL point = 0; double dice = 0.0; // 初期化 INIT(); // 読込み read(); REP(i, N) { point = i + 1; while (point < K) { point = point * 2; dice++; } ans = (1.0 / N) * pow(0.5, dice); sum += ans; point = 0; dice = 0; } printf("%lf\n", sum); return 0; }
//------------------------------------------ // include //------------------------------------------ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> using namespace std; //------------------------------------------ // typedef //------------------------------------------ typedef long long LL; typedef vector<int> VI; typedef vector<bool> VB; typedef vector<char> VC; typedef vector<double> VD; typedef vector<string> VS; typedef vector<LL> VLL; typedef vector<VI> VVI; typedef vector<VB> VVB; typedef vector<VS> VVS; typedef vector<VLL> VVLL; typedef vector<VVI> VVVI; typedef vector<VVLL> VVVLL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<int, string> PIS; typedef pair<string, int> PSI; typedef pair<string, string> PSS; typedef vector<PII> VPII; typedef vector<PLL> VPLL; typedef vector<VPII> VVPII; typedef vector<VPLL> VVPLL; typedef vector<VS> VVS; //------------------------------------------ // comparison //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define CHMIN(a, b) a = min((a), (b)) #define CHMAX(a, b) a = max((a), (b)) #define C_ABS(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) //------------------------------------------ // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, arr) \ for (typeof((arr).begin()) i = (arr).begin(); i != (arr).end(); ++i) #define EXIST(str, e) ((str).find(e) != (str).end()) #define COUNT(arr, v) count((arr).begin(), (arr).end(), v) #define SEARCH(v, w) search((v).begin(), (v).end(), (w).begin(), (w).end()) #define B_SEARCH(arr, v) binary_search((arr).begin(), (arr).end(), v) #define SORT(c) sort((c).begin(), (c).end()) #define RSORT(c) sort((c).rbegin(), (c).rend()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ROTATE_LEFT(arr, c) \ rotate((arr).begin(), (arr).begin() + (c), (arr).end()) #define ROTATE_RIGHT(arr, c) \ rotate((arr).rbegin(), (arr).rbegin() + (c), (arr).rend()) #define SUMI(arr) accumulate((arr).begin(), (arr).end(), 0) #define SUMD(arr) accumulate((arr).begin(), (arr).end(), 0.) #define SUMLL(arr) accumulate((arr).begin(), (arr).end(), 0LL) #define SUMS(arr) accumulate((arr).begin(), (arr).end(), string()) #define UB(arr, n) upper_bound((arr).begin(), (arr).end(), n) #define LB(arr, n) lower_bound((arr).begin(), (arr).end(), n) #define OF_ALL(arr, func) all_of((arr).begin(), (arr).end(), (func)) #define OF_NONE(arr, func) none_of((arr).begin(), (arr).end(), (func)) #define OF_ANY(arr, func) any_of((arr).begin(), (arr).end(), (func)) #define PB push_back #define MP make_pair //------------------------------------------ // input output //------------------------------------------ #define GL(s) getline(cin, (s)) #define INIT() \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); #define OUT(d) std::cout << (d) #define OUT_L(d) std::cout << (d) << endl #define FOUT(n, data) std::cout << std::fixed << std::setprecision(n) << (data) #define FOUT_L(n, data) \ std::cout << std::fixed << std::setprecision(n) << (data) << "\n" #define EL() printf("\n") #define SHOW_VECTOR(v) \ { \ std::cerr << #v << "\t:"; \ for (const auto &xxx : v) { \ std::cerr << xxx << " "; \ } \ std::cerr << "\n"; \ } #define SHOW_MAP(v) \ { \ std::cerr << #v << endl; \ for (const auto &xxx : v) { \ std::cerr << xxx.first << " " << xxx.second << "\n"; \ } \ } #define Yes() printf("Yes\n") #define No() printf("No\n") #define YES() printf("YES\n") #define NO() printf("NO\n") //------------------------------------------ // repetition //------------------------------------------ #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define FORLL(i, a, b) for (LL i = LL(a); i < LL(b); ++i) #define RFORLL(i, a, b) for (LL i = LL(b) - 1; i >= LL(a); --i) #define REPLL(i, n) for (LL i = 0; i < LL(n); ++i) #define RREPLL(i, n) for (LL i = LL(n) - 1; i >= 0; --i) #define FOREACH(x, arr) for (auto &(x) : (arr)) #define FORITER(x, arr) for (auto(x) = (arr).begin(); (x) != (arr).end(); ++(x)) //************************************** //最大公約数 //************************************** template <class T> inline T GCD(const T x, const T y) { if (x < 0) return GCD(-x, y); if (y < 0) return GCD(x, -y); return (!y) ? x : GCD(y, x % y); } //************************************** // nの約数 //************************************** template <typename T> vector<T> DIVISOR(T n) { vector<T> v; for (LL i = 1; i * i <= n; ++i) { if (n % i == 0) { v.push_back(i); if (i != n / i) { v.push_back(n / i); } } } sort(v.begin(), v.end()); return v; } //------------------------------------------ // global //------------------------------------------ // int A = 0; VLL A; // int B = 0; LL B = 0; LL C = 0; LL D = 0; LL E = 0; LL G = 0; LL N = 0; LL M = 0; LL K = 0; LL T = 0; LL R = 0; VLL V; LL W = 0; LL Q = 0; string S = ""; VPLL Pair; LL i, j, k = 0; VLL Array; VC t; /* std::string str[3]; int h[100] = {0}; int h_size = 0; int MinCount = 0; LL i,j,k = 0; LL ans1,ans2 = 0; VLL A; LL K; LL K_pow = 0; LL K_num = 1; LL tmp = 0; */ //------------------------------------------ // read //------------------------------------------ void read(void) { cin >> N >> K; /* A.resize(N); REP(i, N) { cin >> A[i]; } */ } int main() { double ans = 0; double sum = 0; LL point = 0; double dice = 0.0; // 初期化 INIT(); // 読込み read(); REP(i, N) { point = i + 1; while (point < K) { point = point * 2; dice++; } ans = (1.0 / N) * pow(0.5, dice); sum += ans; point = 0; dice = 0; } printf("%.9f\n", sum); return 0; }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
861,519
861,520
u226861390
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n = 0, k = 0; int count = 0; double times = 0; double prob = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { count = i; while (k >= count) { count = count * 2; times++; } prob = prob + ((double)1 / n * (pow((double)1 / 2, times))); count = 0; times = 0; } cout << setprecision(12) << prob; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n = 0, k = 0; int count = 0; double times = 0; double prob = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { count = i; while (k > count) { count = count * 2; times++; } prob = prob + ((double)1 / n * (pow((double)1 / 2, times))); count = 0; times = 0; } cout << setprecision(12) << prob; return 0; }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
861,547
861,548
u734455596
cpp
p03043
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; double prob = 0; for (int i = 1; i <= N; i++) { int dcount = 0; int score = i; while (score < K) { score *= 2; dcount++; } prob += pow(0.5, dcount); } prob *= 1.0 / N; printf("%lf\n", prob); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; double prob = 0; for (int i = 1; i <= N; i++) { int dcount = 0; int score = i; while (score < K) { score *= 2; dcount++; } prob += pow(0.5, dcount); } prob *= 1.0 / N; printf("%.13lf\n", prob); return 0; }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
861,566
861,567
u624923345
cpp
p03043
#include <bits/stdc++.h> #define ll long long int #define N 100000 #define M 1000000007 #define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++) #define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--) #define po pop_back #define pb push_back #define lb lower_bound #define ub upper_bound #define ibs ios_base::sync_with_stdio(false) #define cti cin.tie(0) #define PI 3.14159265 #define cot cout.tie(0) using namespace std; /** * @author :: Sawlani * */ vector<ll> cal(40, 0); ll pre() { cal[0] = 1; f(i, 1, 39) { cal[i] = pow(2, i); } } ll near(ll num) { ll k = lb(cal.begin(), cal.end(), num) - cal.begin(); return k; } int main() { pre(); ll n, k; cin >> n >> k; double ans = 0.0; f(i, 1, n) { ll j; if (k % i == 0) j = near(k / i); else j = near(k / i + 1); // cout << j << endl; ans = ans + ((1.0 / (double)n) * (1.0 / (double)pow(2, j))); } cout << fixed << setprecision(8); cout << ans << endl; }
#include <bits/stdc++.h> #define ll long long int #define N 100000 #define M 1000000007 #define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++) #define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--) #define po pop_back #define pb push_back #define lb lower_bound #define ub upper_bound #define ibs ios_base::sync_with_stdio(false) #define cti cin.tie(0) #define PI 3.14159265 #define cot cout.tie(0) using namespace std; /** * @author :: Sawlani * */ vector<ll> cal(40, 0); ll pre() { cal[0] = 1; f(i, 1, 39) { cal[i] = pow(2, i); } } ll near(ll num) { ll k = lb(cal.begin(), cal.end(), num) - cal.begin(); return k; } int main() { pre(); ll n, k; cin >> n >> k; double ans = 0.0; f(i, 1, n) { ll j; if (k % i == 0) j = near(k / i); else j = near(k / i + 1); // cout << j << endl; ans = ans + ((1.0 / (double)n) * (1.0 / (double)pow(2, j))); } cout << fixed << setprecision(13); cout << ans << endl; }
[ "literal.number.change", "io.output.change" ]
861,568
861,569
u773105035
cpp
p03043
#include <algorithm> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <typeinfo> #include <utility> #include <vector> #define all(x) (x).begin(), (x).end() #define rep(i, m, n) for (int i = m; i < n; ++i) #define pb push_back #define fore(i, a) for (auto &i : a) #define rrep(i, m, n) for (int i = m; i >= n; --i) #define INF INT_MAX / 2 using namespace std; using ll = long long; int main() { double N, K; scanf("%lf %lf", &N, &K); double P; double j; double sum; sum = 0; for (int i = 1; i < N + 1; i++) { j = 1; while (1) { if (i * j >= K) { break; } j = j * 2; } P = 1 / j / N; sum = sum + P; j = 1; } printf("%f", sum); return 0; }
#include <algorithm> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <typeinfo> #include <utility> #include <vector> #define all(x) (x).begin(), (x).end() #define rep(i, m, n) for (int i = m; i < n; ++i) #define pb push_back #define fore(i, a) for (auto &i : a) #define rrep(i, m, n) for (int i = m; i >= n; --i) #define INF INT_MAX / 2 using namespace std; using ll = long long; int main() { double N, K; scanf("%lf %lf", &N, &K); double P; double j; double sum; sum = 0; for (int i = 1; i < N + 1; i++) { j = 1; while (1) { if (i * j >= K) { break; } j = j * 2; } P = 1 / j / N; sum = sum + P; j = 1; } printf("%.16f", sum); return 0; }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
861,573
861,574
u919394785
cpp