QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#450756 | #5557. Enjoyable Entree | Ebiarat# | AC ✓ | 0ms | 4032kb | C++20 | 3.1kb | 2024-06-22 17:37:58 | 2024-06-22 17:37:58 |
Judging History
answer
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <sstream>
#include <ctime>
#include <iterator>
#include <string.h>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <fstream>
#include <assert.h>
#include <numeric>
#include <complex>
#include <random>
#include <utility>
#define IOS ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a) - 1; i>=(b);i--)
#define rep(i,n) FOR(i,0,n)
#define PB push_back
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define VI vector<int>
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VL vector<long long >
#define FILL(a, value) memset(a, value, sizeof(a))
const int nax = 2 * (int)1e5 + 147;
using namespace std;
const int MOD = 998244353;
const int INF = 1e9 +47 ;
const long long LINF = (long long)1e18 + 4747;
typedef long long LL;
const double EPS=1e-6;
struct my_matrix {
vector<vector<double >> mul(vector<vector<double>> a, vector<vector<double>> b )
{
vector<vector<double>>ans;
ans.resize(SZ(a));
rep(i,SZ(a))ans[i].resize(SZ(b));
rep(i,SZ(a))rep(j,SZ(b))ans[i][j] = 0;
for(int i=0;i<SZ(a);i++){
for(int j=0;j<SZ(a[i]);j++){
for(int k = 0;k<SZ(b);k++)
ans[i][k] =(ans[i][k]+(a[i][j]*b[j][k]));
}
}
return ans;
}
void pow(LL n)
{
vector<vector<double>>res{{50,25}};
vector<vector<double>>a{{0,0.5},{1,0.5}};
while(n > 0 )
{
if(n % 2 == 1)res = mul(res,a);
n/=2;
a = mul(a,a);
}
cout << fixed << setprecision(10) << res[0][0] << ' ' << 100 - res[0][0] << '\n';
}
}M;
int main() {
int n;
cin >> n;
if(n == 1) cout << 100.0 << ' ' << 0.0 << '\n';
else if(n == 2) cout << 0.0 << ' ' << 100.0 << '\n';
else if(n == 3) cout << 50.0 << ' ' << 50.0 << '\n';
else M.pow(n - 3);
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3740kb
input:
1
output:
100 0
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
3
output:
50 50
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
7
output:
34.3750000000 65.6250000000
result:
ok 2 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
2
output:
0 100
result:
ok 2 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
4
output:
25.0000000000 75.0000000000
result:
ok 2 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
5
output:
37.5000000000 62.5000000000
result:
ok 2 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
6
output:
31.2500000000 68.7500000000
result:
ok 2 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
8
output:
32.8125000000 67.1875000000
result:
ok 2 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
9
output:
33.5937500000 66.4062500000
result:
ok 2 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 4020kb
input:
10
output:
33.2031250000 66.7968750000
result:
ok 2 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
11
output:
33.3984375000 66.6015625000
result:
ok 2 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
12
output:
33.3007812500 66.6992187500
result:
ok 2 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
13
output:
33.3496093750 66.6503906250
result:
ok 2 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
14
output:
33.3251953125 66.6748046875
result:
ok 2 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
15
output:
33.3374023438 66.6625976562
result:
ok 2 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 4028kb
input:
16
output:
33.3312988281 66.6687011719
result:
ok 2 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
17
output:
33.3343505859 66.6656494141
result:
ok 2 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
18
output:
33.3328247070 66.6671752930
result:
ok 2 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
19
output:
33.3335876465 66.6664123535
result:
ok 2 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
20
output:
33.3332061768 66.6667938232
result:
ok 2 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
21
output:
33.3333969116 66.6666030884
result:
ok 2 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
22
output:
33.3333015442 66.6666984558
result:
ok 2 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
23
output:
33.3333492279 66.6666507721
result:
ok 2 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
24
output:
33.3333253860 66.6666746140
result:
ok 2 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
25
output:
33.3333373070 66.6666626930
result:
ok 2 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
26
output:
33.3333313465 66.6666686535
result:
ok 2 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 4024kb
input:
27
output:
33.3333343267 66.6666656733
result:
ok 2 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
28
output:
33.3333328366 66.6666671634
result:
ok 2 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
29
output:
33.3333335817 66.6666664183
result:
ok 2 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
30
output:
33.3333332092 66.6666667908
result:
ok 2 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
645
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
9664
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
92124
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
655217
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
1906604
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
14158782
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
118145010
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
2200494025
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
43605764225
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
804695488029
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
6627335577483
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
63784486977434
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
162874566997492
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
7889646630282564
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
93757501737327402
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
633156281075725080
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
999999999999999999
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 4020kb
input:
1000000000000000000
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
2147483646
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
2147483647
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #51:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2147483648
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #52:
score: 0
Accepted
time: 0ms
memory: 4032kb
input:
2147483649
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #53:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
4294967294
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #54:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
4294967295
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #55:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
4294967296
output:
33.3333333333 66.6666666667
result:
ok 2 numbers
Test #56:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
4294967297
output:
33.3333333333 66.6666666667
result:
ok 2 numbers