题目大意:给定两个数字 x 1 , x 2 x_1, x_2 x1,x2,以及参数 p 1 , p 2 p_1,p_2 p1,p2,表示在 x 1 , x 2 x_1,x_2 x1,x2后面加上 p 1 , p 2 p1_,p_2 p1,p2个 0 0 0。然后比较 a a a和 b b b的大小.
思路分析:首先统一数位,将两个数字化为相同位数的数字,然后根据后缀( 1 0 ( p 2 − p 1 ) 10^{(p_2 - p_1)} 10(p2−p1))分类讨论即可。
#include
#define int long long
using namespace std;
int get(int num, int cnt = 0){
while(num) cnt += 1, num /= 10;
return cnt;
}
inline void solve(){
int x1, p1; cin >> x1 >> p1;
int x2, p2; cin >> x2 >> p2;
int xp1 = get(x1), xp2 = get(x2);
if(xp1 > xp2) while(xp1 - xp2) xp1--, x2 *= 10, p2--;
if(xp2 > xp1) while(xp2 - xp1) xp2--, x1 *= 10, p1--;
int det = p2 - p1;
if(x1 > x2) puts((det > t;
while(t--) solve();
return 0;
}
B.Absent Remainder
题目大意:给定序列 { a 1 , a 2 , … , a n } \{a_1, a_2, \dots, a_n\} {a1,a2,…,an},序列内元素各不相同。要求构造 ⌊ n 2 ⌋ \lfloor \frac{n}{2} \rfloor ⌊2n⌋对 ( x , y ) (x, y) (x,y),满足 x ≠ y ∩ x m o d y ∉ { a i } x \neq y\ \cap\ x \mod y \notin \{a_i\} x=y ∩ xmody∈/{ai}。
找到序列的最小值作为 y y y,然后找 ⌊ n 2 ⌋ \lfloor \frac{n}{2} \rfloor ⌊2n⌋对元素作为 x x x即可。容易知道 a i m o d a m i n n < a m i n n a_i \mod a_{minn} < a_{minn} aimodaminn> n; for(int i = 1; i > a[i]; sort(a + 1, a + 1 + n); for(int i = 1; i
- 回坑记之或许是退役赛季?
- [LCT刷题] P1501 [国家集训队]Tree II
- [LCT刷题] P2147 洞穴勘测
- 2022-2023 ICPC Brazil Subregional Programming Contest VP记录
- [线段树套单调栈] 2019-2020 ICPC Asia Hong Kong Regional Contest H.[Hold the Line]
- The 2021 ICPC Asia Nanjing Regional Contest E.Paimon Segment Tree 区间合并线段树/维护矩阵乘法
- CF580E - Kefa and Watch 线段树维护哈希
- HDU5869 Different GCD Subarray Query 离线查询/区间贡献
- 27.CF1004F Sonya and Bitwise OR 区间合并线段树
- 26.CF1000F One Occurrence