結果
問題 | No.2125 Inverse Sum |
ユーザー | Nzt3 |
提出日時 | 2022-11-18 22:44:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 546 bytes |
コンパイル時間 | 2,606 ms |
コンパイル使用メモリ | 209,496 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-20 07:44:13 |
合計ジャッジ時間 | 5,855 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | TLE | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); long long P,Q; cin>>P>>Q; if(P>Q*2){ cout<<"0\n"; return 0; } long long G=gcd(P,Q); P/=G,Q/=G; vector<array<long long,2>>ans; for(long long i=Q/P+1;i<=2*Q/P;i++){ if(Q*i%(P*i-Q)==0){ ans.push_back({i,Q*i/(P*i-Q)}); if(i!=Q*i/(P*i-Q)){ ans.push_back({Q*i/(P*i-Q),i}); } } } sort(ans.begin(),ans.end()); cout<<ans.size()<<'\n'; for(auto i:ans)cout<<i[0]<<' '<<i[1]<<'\n'; }