#include<stdio.h>
#include<string.h>
#include<stdlib.h>
const int N = 1e5+10;
char a1[N],a2[N];//分别为a1和a2的字符串
int lena,lenb;//分别为a1和a2的字符串长度
//比较a2和5谁大 1代表比5大,2代表比5小,0代表相等于5
int cmp()
{
if(a2[1]>'5')return 1;
if(a2[1]<'5')return 2;
//可以把小数点后的5看成,a2除第一位以外的每一位和0比较大小,如果有比0大说明就比5大
for(int i = 2;i<=lenb;i++)
{
if(a2[i]>'0')return 1;
}
return 0;
}
int main(void)
{
//因为a1和a2长度会有1e5,所以要用字符将他们保存
scanf("%s",a1+1);
scanf("%s",a2+1);
lena = strlen(a1+1);
lenb = strlen(a2+1);
int flag = cmp();
// printf("%d\n",flag);
if(flag == 1)
printf("Happy birthday to MFGG");
else if(flag == 2)
{
//注意如果a2是0的话,改变后的数是和原数相等的
if(a2[1] != '0')
printf("Happy birthday to YXGG");
else
//否则和原数相比一定是小了
printf("PLMM");
}
else
{
int k = (a1[lena]-'0')%2;//判断a1的个位是奇数还是偶数
if(k == 1)//说明是奇数,那么一定比原数大
printf("Happy birthday to MFGG");
else//否则一定小了
printf("Happy birthday to YXGG");
}
return 0;
}
标签:return,61,int,printf,a1,牛客,a2,小白月赛,Happy
From: https://www.cnblogs.com/loliconsk/p/16906566.html