QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#379913 | #5103. Fair Division | UFRJ# | WA | 2ms | 3576kb | C++20 | 780b | 2024-04-06 19:52:27 | 2024-04-06 19:52:28 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
using lint = int64_t;
const int ms = 1e5;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
lint N, M;
cin>>N>>M;
__int128_t m = M;
for(int q=2;q<ms;q++){
for(int p=1;p<q;p++){
__int128_t l = 1, r = 1;
bool ok = true;
for(int i=0;i<N;i++){
l *= q;
r *= (q - p);
if(l - r > 5 * m * p){
ok = false;
break;
}
}
if(!ok) break;
if( (m * p) % (l - r) == 0){
cout<<p<<" "<<q<<"\n";
return 0;
}
}
}
cout<<"impossible\n";
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3576kb
input:
13 382475111752106101
output:
impossible
result:
wrong answer 1st lines differ - expected: '17 28', found: 'impossible'