题目链接-D.Fake News
题目大意
判断 1 2 + 2 2 + … + n 2 1^2+2^2+…+n^2 12+22+…+n2的和是否是一个平方数
解题思路
通过打表得出只有 n = 1 n=1 n=1或 n = 24 n=24 n=24的时候, 1 2 + 2 2 + … + n 2 1^2+2^2+…+n^2 12+22+…+n2的和才是平方数
附上代码
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include
#define int long long
#define lowbit(x) (x &(-x))
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
const double PI=acos(-1.0);
const double e=exp(1.0);
const double eps=1e-10;
const int M=1e9+7;
const int N=2e5+10;
typedef long long ll;
typedef pair<int,int> PII;
typedef unsigned long long ull;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n==1||n==24) cout<<"Fake news!"<<endl;
else cout<<"Nobody knows it better than me!"<<endl;
}
return 0;
}