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

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 1 to n, the sum will never be a square number?’
As another reporter in that press conference, you also wondering that given n, whether在这里插入图片描述

is a square number. Specifically, we regard a positive number x as a square number when there exists an integer y satisfying
在这里插入图片描述
在这里插入图片描述
输入:

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!

题意:
签到题:
在这里插入图片描述的结果求根号之后是不是整数
题解:
打表之后发现就只有1和24满足条件,直接输出结果
Code:

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define ss(a) scanf("%s", a)
#define mem(a, b) memset(a, b, sizeof(a))
#define PII pair<int, int>
using namespace std;
int main(){
    int t;sc(t);
    while(t--){
        LL n;
        scanf("%lld",&n);
        if(n==1||n==24)printf("Fake news!\n");
        else printf("Nobody knows it better than me!\n");
    }
    system("pause");
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值