QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#843856 | #9962. Diminishing Fractions | ucup-team3608# | WA | 0ms | 3556kb | C++23 | 1.0kb | 2025-01-05 04:11:12 | 2025-01-05 04:11:13 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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