题意:
判断1到n的平方和是否为平方数。
题解:
因为是大数,一开始用python冲,发现连输入1e6就直接T了。根据平方和公式,感觉很难拆成两个相等的数,因为n与n+1是互质的,打表直接冲,发现1e7之内只有1和24,猜一下只有1和24满足,冲,过了。
AC代码:
#include <iostream>
using namespace std;
typedef long long ll;
int main () {
int T;
scanf("%d", &T);
while (T--) {
ll n;
scanf("%lld", &n);
puts(((n == 1) || (n == 24)) ? "Fake news!" : "Nobody knows it better than me!");
}
}