QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#450748 | #5557. Enjoyable Entree | Ebiarat# | WA | 0ms | 3528kb | C++20 | 3.1kb | 2024-06-22 17:34:50 | 2024-06-22 17:34:50 |
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 << 50 << ' ' << 0 << '\n';
else if(n == 2) cout << 0 << ' ' << 100 << '\n';
else if(n == 3) cout << 50 << ' ' << 50 << '\n';
else M.pow(n - 3);
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3528kb
input:
1
output:
50 0
result:
wrong answer 1st numbers differ - expected: '100.0000000', found: '50.0000000', error = '0.5000000'