2020牛客暑期多校训练营(第七场)D

Fake News

https://ac.nowcoder.com/acm/contest/5672/D

题目描述

  McDonald Thumb, the greatest president ever in the history of the Great Tokitsukaze Kingdom has held his 100th press conference about the global pandemic after making his 1000000th tweets with his smartphone. With a big smile on his face, Mr. Thumb said that nobody knows math more than he does.
  "I learn math since I was born and I am very good at it,", said Mr. Thumb," People keep asking me why I know math so much and I sometimes find myself having those amazing ideas about math."
  "For example?", asked by a reporter.
  "Oh you, I know you! Fake news! You and your agency always produce fake news!", replied angrily by Mr. Thumb," Let me teach you something, do you know if you add up the squares of numbers from to , the sum will never be a square number?"
  As another reporter in that press conference, you also wondering that given , whether is a square number. Specifically, we regard a positive number as a square number when there exists an integer satisfying .

输入描述

  There are multiple test cases. The first line of the input contains an integer indicating the number of test cases.
  For each test case, the first line contains one integers .

输出描述

  If the sum is a square number, please output "Fake news!" in one line. Otherwise, please output "Nobody knows it better than me!" instead.

示例1

输入

5
1
2
3
4
5

输出

Fake news!
Nobody knows it better than me!
Nobody knows it better than me!
Nobody knows it better than me!
Nobody knows it better than me!

分析

  打表题,当且仅当 时, 为完全平方数。
  知乎上的巨佬们给出了一些证明

代码

/******************************************************************
Copyright: 11D_Beyonder All Rights Reserved
Author: 11D_Beyonder
Problem ID: 2020牛客暑期多校训练营(第七场)Problem D
Date: 8/27/2020
Description: Just Attempt
*******************************************************************/
#include<stdio.h>
int main(){
    int _;
    for(scanf("%d",&_);_;_--){
        long long n;
        scanf("%lld",&n);
        if(n==1||n==24){
            puts("Fake news!");
        }else{
            puts("Nobody knows it better than me!");
        }
    }
    return 0;
}
牛客暑期多校训练营题解 文章被收录于专栏

收集牛客暑期多校训练营的题解

全部评论

相关推荐

offer多多的六边形战士很无语:看了你的博客,感觉挺不错的,可以把你的访问量和粉丝数在简历里提一下,闪光点(仅个人意见)
点赞 评论 收藏
分享
jack_miller:杜:你不用我那你就用我的美赞臣
点赞 评论 收藏
分享
昨天 00:11
已编辑
广东工业大学 算法工程师
避雷深圳&nbsp;&nbsp;yidao,试用期&nbsp;6&nbsp;个月。好嘛,试用期还没结束,就直接告诉你尽快找下一家吧,我谢谢您嘞
牛客75408465号:笑死,直属领导和 hr 口径都没统一,各自说了一些离谱的被裁理由,你们能不能认真一点呀,哈哈哈哈哈😅😅😅
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务