QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#70708#5103. Fair DivisionnvmdavaWA 2ms3376kbC++20912b2023-01-07 16:14:002023-01-07 16:14:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-07 16:14:01]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3376kb
  • [2023-01-07 16:14:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ff first
#define ss second


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    ll m;
    cin>>m;

    for(ll q = 1; q < 4000; q++) {
        for(ll p = q - 1; p > 0; --p) {
            if(__gcd(p, q) > 1) continue;
            ll s = 1;
            ll t = 1;
            bool lim = 0;
            for(int i = 1; i < n; ++i) {
                if(t > m / p || s > m / q) {
                    lim = 1;
                    break;
                }
                t *= p;
                s = s * q + t;
            }
            if(lim) continue;
            cout<<q - p<<' '<<q<<' '<<s<<'\n';
            if(m % s == 0) {
                cout<<q - p<<' '<<q;
                return 0;
            }
        }
    }
    cout<<"impossible";
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3376kb

input:

13 382475111752106101

output:

1 2 8191
1 3 1586131
2 3 797161
1 4 65514541
3 4 22369621
1 5 1153594261
2 5 609554401
3 5 406898311
4 5 305175781
1 6 11839990891
5 6 2612138803
1 7 83828316391
2 7 47834153641
3 7 32273967181
4 7 24221854021
5 7 19377800443
6 7 16148168401
1 8 452866803481
3 8 182845036921
5 8 109950843913
7 8 785...

result:

wrong answer 1st lines differ - expected: '17 28', found: '1 2 8191'