QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#843861 | #9962. Diminishing Fractions | ucup-team3608# | WA | 0ms | 3832kb | C++23 | 1.0kb | 2025-01-05 04:20:09 | 2025-01-05 04:20:15 |
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;
int ind = 0;
for(int i=1;i<23;i++){
int k = *max_element(choose[i].begin(), choose[i].end());
if(k > n) break;
if(i >= n-i) break;
ind = i;
}
for(int j=0;j<=ind;j++){
if(j){
if(j&1) cout<<"-";
else cout<<"+";
}
cout<<choose[ind][j]<<"/"<<n-ind+j;
}
cout<<"\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
2 3 6
output:
1/2-1/3 1/4-2/5+1/6
result:
ok OK, t = 2
Test #2:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1 1
output:
1/1
result:
ok OK, t = 1
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3800kb
input:
10 1 2 3 4 5 6 7 8 9 10
output:
1/1 1/2 1/2-1/3 1/3-1/4 1/3-2/4+1/5 1/4-2/5+1/6 1/4-3/5+3/6-1/7 1/5-3/6+3/7-1/8 1/5-4/6+6/7-4/8+1/9 1/6-4/7+6/8-4/9+1/10
result:
wrong answer Sums do not match for modulus 8809877585262195773