全WA求助
查看原帖
全WA求助
381817
Kiichi楼主2021/10/4 18:15

思路是面积相等情况下,长宽越接近周长越小,所以直接考虑最小情况

#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL T, n, m;
int main() {
	cin >> T;
    while(T--) {
        cin >> n >> m;
        if(n > m) {cout << "Miss" << endl; continue; }
        if(sqrt(n) == (LL)sqrt(n)) {
            if(((sqrt(n) + 1) + (sqrt(n) + 1) * 2) <= m) cout << "Good" << endl;
            else cout << "Miss" << endl;
        } else {
            if(((((LL)sqrt(n)) + 1) + (((LL)sqrt(n)) + 2) * 2) <= m) cout << "Good" << endl;
            else cout << "Miss" << endl;
        }
    }
	return 0;
}
2021/10/4 18:15
加载中...