1 条题解
-
0
自动搬运
来自洛谷,原作者为

asd890123
蒟蒻搬运于
2025-08-24 23:04:38,当前版本为作者最后更新于2024-10-02 21:38:24,作者可能在搬运后再次修改,您可在原文处查看最新版自动搬运只会搬运当前题目点赞数最高的题解,您可前往洛谷题解查看更多
以下是正文
将题目进一步形式化:
输出 和 ,评测机会给出对应的 和
我们令
相邻两数必然互素, 互素。
构造一组 使得:
得: 即可满足
所以
代码:
#include <iostream> typedef long long LL; const LL Max = 4e8; const LL mod = (LL)1e17 + 1; int main(){ std::cin.tie(0)->sync_with_stdio(0); int T; for (std::cin >> T;T--;){ LL res1,res2; std::cout << "? " << Max << std::endl; std::cin >> res1; std::cout << "? " << Max - 1 << std::endl; std::cin >> res2; std::cout << "! " << (Max * res2 + (Max - 1) * Max - (Max - 1) * res1) % (Max * (Max - 1)) << '\n'; } return 0; }
- 1
信息
- ID
- 10468
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 3
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者