摘要: 题目传送门 题解: 题目大意: 给定long long范围内整数n,p,w,d 求满足方程wx+dy=p的一组和小于等于n的自然数解 \(1\leq n\leq10^{12},0\leq p \leq10^{17},1\leq d<w \leq10^{5}\) 题干给定的信息很容易联想到使用扩展欧几 阅读全文
posted @ 2021-05-22 00:06 ambrumf 阅读(60) 评论(0) 推荐(0) 编辑
摘要: I. A Small Game 题解: 这一题可以反向思考,考虑如何从x得到0.因为本题的倍乘机制决定了即使我们用更小的代价到达了更大的x值,这个x值不一定会在最优路线中被用到.因此我们不能根据x的绝对大小及当前代价直接剪枝,如果反向递推时,当前值为偶数时的最优情况比较特殊,对于偶数,加1一定不是最 阅读全文
posted @ 2021-05-16 23:15 ambrumf 阅读(54) 评论(0) 推荐(0) 编辑
摘要: B - Two Arrays And Swaps You are given two arrays a and b both consisting of n positive (greater than zero) integers. You are also given an integer k. 阅读全文
posted @ 2020-12-06 12:25 ambrumf 阅读(46) 评论(0) 推荐(0) 编辑
摘要: A - Most Unstable Array You are given two integers n and m. You have to construct the array a of length n consisting of non-negative integers (i.e. in 阅读全文
posted @ 2020-12-06 12:22 ambrumf 阅读(50) 评论(0) 推荐(0) 编辑