QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#843856#9962. Diminishing Fractionsucup-team3608#WA 0ms3556kbC++231.0kb2025-01-05 04:11:122025-01-05 04:11:13

Judging History

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

  • [2025-01-05 04:11:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3556kb
  • [2025-01-05 04:11:12]
  • 提交

answer

#include <bits/stdc++.h>
#define st first
#define nd second
using lint = long long;
constexpr int mod = 998244353;
constexpr int inf = 0x3f3f3f3f;
constexpr lint linf = 0x3f3f3f3f3f3f3f3f;
using namespace std;

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    vector<vector<int>>choose(23);
    for(int i=0;i<23;i++){
        choose[i] = vector<int>(i+1);
        choose[i][0] = choose[i][i] = 1;
        for(int j=1;j<i;j++) choose[i][j] = choose[i-1][j] + choose[i-1][j-1];
    }
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        for(int i=22;i>=0;i--){
            int k = *max_element(choose[i].begin(), choose[i].end());
            if(k > n) continue;
            if(i >= n) continue;
            for(int j=0;j<=i;j++){
                if(j){
                    if(j&1) cout<<"-";
                    else cout<<"+";
                }
                cout<<choose[i][j]<<"/"<<n-i+j;
            }
            cout<<"\n";
            break;
        }

    }



    return 0;
}

詳細信息

Test #1:

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

input:

2
3
6

output:

1/1-2/2+1/3
1/2-4/3+6/4-4/5+1/6

result:

wrong answer Sums do not match for modulus 8809877585262195773