题解 | #小红的取模构造#
小红的取模构造
https://www.nowcoder.com/practice/679758a0bde0479d88463438ccee81c4
#include <iostream> using namespace std; int main() { int t; cin >> t; while(t--){ int a, b; cin >> a >> b; if(a == b && a == 0)cout << "1 1"; else if(a == 0) cout << b * 2 << " " << b; else if(b == 0) cout << a << " " << a * 2; else if(a == b)cout << -1 << -1; else { if(a > b){ cout << a << " " << a + b; } else cout << a + b << " " << b; } cout << endl; } } // 64 位输出请用 printf("%lld")
分类讨论
#悬赏#言の随记题解 文章被收录于专栏
喵喵喵喵喵