Jessie has a magic mirror.Every morning she will ask the mirror: 'Mirror mirror tell me, who is the most beautiful girl in the world?' If the mirror says her name, she will praise the mirror: 'Good guy!', but if the mirror says the name of another person, she will assail the mirror: 'Dare you say that again?'
Today Jessie asks the mirror the same question above, and you are given a series of mirror's answers. For each answer, please output Jessie's response. You can assume that the uppercase or lowercase letters appearing anywhere in the name will have no influence on the answer. For example, 'Jessie' and 'jessie' represent the same person.
Input
The first line contains an integer T(1≤T≤100)T(1 \le T \le 100)T(1≤T≤100), which is the number of test cases.
Each test case contains one line with a single-word name, which contains only English letters. The length of each name is no more than 151515.
Output
For each test case, output one line containing the answer.
样例输入
2
Jessie
Justin
样例输出
Good guy!
Dare you say that again?
题目来源
解题思路:水题,不做解释
#include<bits/stdc++.h>
using namespace std;
char a[]="jessie";
int main(void)
{
char name[17];
int n;
scanf("%d",&n);
getchar();
for(int i=0;i<n;i++)
{
scanf("%s",name);
int len=strlen(name);
for(int j=0;j<len;j++)
name[j]=tolower(name[j]);
bool flag=true;
if(len!=6)
{
printf("Dare you say that again?\n");
continue;
}
for(int j=0;j<len;j++)
{
if(name[j]!=a[j])
{
flag=false;
break;
}
}
printf("%s\n",flag?"Good guy!":"Dare you say that again?");
}
return 0;
}
There are NNN children in kindergarten. Miss Li bought them NNN candies. To make the process more interesting, Miss Li comes up with the rule: All the children line up according to their student number (1...N)(1...N)(1...N), and each time a child is invited, Miss Li randomly gives him some candies (at least one). The process goes on until there is no candy. Miss Li wants to know how many possible different distribution results are there.
Input
The first line contains an integer TTT, the number of test case.
The next TTT lines, each contains an integer NNN.
1≤T≤1001 \le T \le 1001≤T≤100
1≤N≤101000001 \le N \le 10^{100000}1≤N≤10100000
Output
For each test case output the number of possible results (mod 1000000007).
样例输入
1
4
样例输出
8
题目来源
解题思路:小费马定理 (mod p)。其实这题我们都找出规律来,就是2的n-1次方,但是这题的数据实在是太大,只能用字符串来输入数据并且还要用小费马定理来降幂,具体的推导过程:
(mod p)
(mod p) 我们又知道n-1可以转化成k(p-1)+m 所以
%p=
%p*
%p 又
所以
%p=
%p 因n-1=k(p-1)+m 所以m=(n-1)%(p-1) 所以最后
%p=
%p
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod=1e9+6;
const int MOD=1e9+7;
char s[100005];
LL quickpow(LL a,LL b)
{
LL ans=1;
while(b)
{
if(b&1)ans=ans*a%MOD;
a=a*a%MOD;
b>>=1;
}
return ans%MOD;
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%s",s);
if(s=="1")
{
printf("1\n");
continue;
}
int l=strlen(s),pos;
if(s[l-1]>'0')s[l-1]--;
else
{
s[l-1]='9';
pos=l-2;
while(s[pos]=='0')
{
s[pos]='9';
pos--;
}
s[pos]--;
}
LL a=0;
for(int i=0;i<l;i++)
{
a=a*10+(s[i]-'0');
a=a%mod;
}
LL ans=quickpow(2,a);
printf("%lld\n",ans%MOD);
}
}
Bob is a sorcerer. He lives in a cuboid room which has a length of AAA, a width of BBB and a height of CCC, so we represent it as AAA * BBB * CCC. One day, he finds that his room is filled with unknown dark energy. Bob wants to neutralize all the dark energy in his room with his light magic. He can summon a 111 * 111 * 222 cuboid at a time to neutralize dark energy. But the cuboid must be totally in dark energy to take effect. Can you foresee whether Bob can save his room or not?
Input
Input has TTT test cases. T≤100T \le 100T≤100
For each line, there are three integers A,B,CA, B, CA,B,C.
1≤A,B,C≤1001 \le A, B, C \le 1001≤A,B,C≤100
Output
For each test case, if Bob can save his room, print"Yes"
, otherwise print"No"
.
样例输入
1 1 2
1 1 4
1 1 1
样例输出
Yes
Yes
No
题目来源
解题思路:这题只要一条边满足整除2就行。
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
int a,b,c;
while(~scanf("%d%d%d",&a,&b,&c))
{
if(a%2==0||b%2==0||c%2==0)
printf("Yes\n");
else printf("No\n");
}
return 0;
}