QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#573685 | #5557. Enjoyable Entree | V-ioleT | AC ✓ | 0ms | 3976kb | C++20 | 1.2kb | 2024-09-18 19:40:09 | 2024-09-18 19:40:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define ull unsigned long long
typedef long long ll;
#define lowbit(x) ((x) & -(x))
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 1e6 + 5, M = 1e5 + 10;
typedef pair<int, int> PII;
double T = 1 >> 30;
// double PI = acos(-1);
int gcd(int a, int b)
{
return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b)
{
return a / gcd(a, b) * b;
}
double f[105], g[105];
void solve()
{
int i, j;
int n;
cin >> n;
f[1] = 1, f[2] = 0;
g[1] = 0, g[2] = 1;
for (i = 3; i <= 100; i++)
{
f[i] = (f[i - 1] + f[i - 2]) / 2;
g[i] = (g[i - 1] + g[i - 2]) / 2;
}
if (n <= 100)
{
double ans1 = f[n] * 100, ans2 = g[n] * 100;
printf("%.6f %.6f\n", ans1, ans2);
}
else
{
cout << "33.333333 66.666667";
}
}
signed main()
{
// ios_base::sync_with_stdio(false);
// cin.tie(nullptr);
// cout.tie(nullptr);
int t = 1;
// cin >> t;
while (t--)
{
// Case++;
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3948kb
input:
1
output:
100.000000 0.000000
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
3
output:
50.000000 50.000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
7
output:
34.375000 65.625000
result:
ok 2 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
2
output:
0.000000 100.000000
result:
ok 2 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
4
output:
25.000000 75.000000
result:
ok 2 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
5
output:
37.500000 62.500000
result:
ok 2 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
6
output:
31.250000 68.750000
result:
ok 2 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
8
output:
32.812500 67.187500
result:
ok 2 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
9
output:
33.593750 66.406250
result:
ok 2 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
10
output:
33.203125 66.796875
result:
ok 2 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
11
output:
33.398438 66.601562
result:
ok 2 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
12
output:
33.300781 66.699219
result:
ok 2 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
13
output:
33.349609 66.650391
result:
ok 2 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
14
output:
33.325195 66.674805
result:
ok 2 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
15
output:
33.337402 66.662598
result:
ok 2 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
16
output:
33.331299 66.668701
result:
ok 2 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
17
output:
33.334351 66.665649
result:
ok 2 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
18
output:
33.332825 66.667175
result:
ok 2 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
19
output:
33.333588 66.666412
result:
ok 2 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
20
output:
33.333206 66.666794
result:
ok 2 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
21
output:
33.333397 66.666603
result:
ok 2 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
22
output:
33.333302 66.666698
result:
ok 2 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
23
output:
33.333349 66.666651
result:
ok 2 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
24
output:
33.333325 66.666675
result:
ok 2 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
25
output:
33.333337 66.666663
result:
ok 2 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
26
output:
33.333331 66.666669
result:
ok 2 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
27
output:
33.333334 66.666666
result:
ok 2 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
28
output:
33.333333 66.666667
result:
ok 2 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
29
output:
33.333334 66.666666
result:
ok 2 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
30
output:
33.333333 66.666667
result:
ok 2 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
645
output:
33.333333 66.666667
result:
ok 2 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
9664
output:
33.333333 66.666667
result:
ok 2 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
92124
output:
33.333333 66.666667
result:
ok 2 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
655217
output:
33.333333 66.666667
result:
ok 2 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1906604
output:
33.333333 66.666667
result:
ok 2 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
14158782
output:
33.333333 66.666667
result:
ok 2 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
118145010
output:
33.333333 66.666667
result:
ok 2 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
2200494025
output:
33.333333 66.666667
result:
ok 2 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
43605764225
output:
33.333333 66.666667
result:
ok 2 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
804695488029
output:
33.333333 66.666667
result:
ok 2 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
6627335577483
output:
33.333333 66.666667
result:
ok 2 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
63784486977434
output:
33.333333 66.666667
result:
ok 2 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
162874566997492
output:
33.333333 66.666667
result:
ok 2 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
7889646630282564
output:
33.333333 66.666667
result:
ok 2 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
93757501737327402
output:
33.333333 66.666667
result:
ok 2 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
633156281075725080
output:
33.333333 66.666667
result:
ok 2 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
999999999999999999
output:
33.333333 66.666667
result:
ok 2 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1000000000000000000
output:
33.333333 66.666667
result:
ok 2 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
2147483646
output:
33.333333 66.666667
result:
ok 2 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
2147483647
output:
33.333333 66.666667
result:
ok 2 numbers
Test #51:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
2147483648
output:
33.333333 66.666667
result:
ok 2 numbers
Test #52:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
2147483649
output:
33.333333 66.666667
result:
ok 2 numbers
Test #53:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
4294967294
output:
33.333333 66.666667
result:
ok 2 numbers
Test #54:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
4294967295
output:
33.333333 66.666667
result:
ok 2 numbers
Test #55:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
4294967296
output:
33.333333 66.666667
result:
ok 2 numbers
Test #56:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
4294967297
output:
33.333333 66.666667
result:
ok 2 numbers