QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#739598#6819. Largest Unique WinsAmiyaCast#WA 0ms3876kbC++201.8kb2024-11-12 22:21:422024-11-12 22:21:44

Judging History

你现在查看的是最新测评结果

  • [2024-11-12 22:21:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3876kb
  • [2024-11-12 22:21:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
    int n, m;
    cin >> n >> m;
    if (n % 2 == 1) {
        cout << fixed << setprecision(10);
    if(n == 2) {
        for(int i = 1; i <= m - 1; i ++) {
            cout << 0.0 << " ";
        }
        cout << 1.0 << endl;
        for(int i = 1; i <= m - 1; i ++) {
            cout << 0.0 << " ";
        }
        cout << 1.0 << endl;
        return 0;
    }
    int b = m, i;
    for (i = 1; i <= n; i++)
    {
        for (int j = 1; j < b; j++) cout << 0.0 << ' ';
        cout << 1.0 << ' ';
        for (int j = b + 1; j <= m; j++) cout << 0.0 << ' ';
        cout << '\n';
        b--;
        if (b == 0) 
        {
            i++;
            break;
        }
    }
    b = 1;
    for (; i <= n; i++)
    {
        for (int j = 1; j < b; j++) cout << 0.0 << ' ';
        cout << 1.0 << ' ';
        for (int j = b + 1; j <= m; j++) cout << 0.0 << ' ';
        cout << '\n';
        b++;
        if (b > m) b = 1;
    }
    return 0;
    }
    double sum = 1;
    vector<double> ans(m);
    for (int i = 0; i < m - 1; i++) {
        double l = 0, r = sum;
        for (int t = 1; t < 73; t++) {
            double mid = (l + r) / 2;
            double res = n;
            for (int i = 0; i < n - 2; i++) {
                res *= (sum - mid);
            } 
            res *= mid;
            res -= (1.0 - mid);
            if (res < 0) l = mid;
            else r = mid;
        }
        ans[i] = l;
        sum -= l;
    }
    ans[m - 1] = sum;
    for (int i = 0; i < n; i++) {
        for (int j = m - 1; j >= 0; j--) {
            cout << fixed << setprecision(10) << ans[j] << ' ';
        }
        cout << '\n';
    }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3876kb

input:

2 2

output:

0.6666666667 0.3333333333 
0.6666666667 0.3333333333 

result:

wrong answer 1's strategy is not optimal, current = 0.0000000000, better (2) = 0.6666666667