F:日期小助手

日期小助手

https://ac.nowcoder.com/acm/contest/5278/F

直接手动打表。。。
虽然很蠢

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll i,n,y,m,d,rq;
ll t=2000;
ll mo[102]={14,13,12,11,9,8,14,13,11,10,9,8,13,12,11,10,8,14,13,12,10,9,8,14,12,11,10,9,14,13,12,11,9,8,14,13,11,10,9,8,13,12,11,10,8,14,13,12,10,9,8,14,12,11,10,9,14,13,12,11,9,8,14,13,11,10,9,8,13,12,11,10,8,14,13,12,10,9,8,14,12,11,10,9,14,13,12,11,9,8,14,13,11,10,9,8,13,12,11,10,9,8};
ll mother[102];
ll father[102];
ll fa[102]={18,17,16,15,20,19,18,17,15,21,20,19,17,16,15,21,19,18,17,16,21,20,19,18,16,15,21,20,18,17,16,15,20,19,18,17,15,21,20,19,17,16,15,21,19,18,17,16,21,20,19,18,16,15,21,20,18,17,16,15,20,19,18,17,15,21,20,19,17,16,15,21,19,18,17,16,21,20,19,18,16,15,21,20,18,17,16,15,20,19,18,17,15,21,20,19,17,16,15,21,20,19};
char s[5];
int main(int argc, char * argv[]) 
{
    cin>>n;
    for(i=0;i<102;i++)
    {
        mother[i]=mo[i]+t*10000+5*100;
        father[i]=fa[i]+t*10000+6*100;
        t++;
        //printf("%lld %lld \n",mother[i],father[i]);
    }
    while(n--){
        cin>>y>>m>>d;
        rq=y*10000+m*100+d*1;

         if(rq>20000100 && rq<20000514) 
         printf("Mother's Day: May 14th, 2000\n");
         else if (rq>=20000514 && rq<20000618) 
         printf("Father's Day: June 18th, 2000\n");
         else{

    for(i=1;i<102;i++)
    {
    if(rq>=mother[i] && rq<father[i])
     {
        d=father[i]%100;
        y=father[i]/10000;
          if(d==1 || d==21 || d==31 ) {s[0]='s';s[1]='t';}
        else if(d==2 || d==22 || d==32 ) {s[0]='n';s[1]='d';}
        else if(d==3 || d==23 || d== 33 ) {s[0]='r';s[1]='d';}
        else 
        {s[0]='t';
        s[1]='h';
         }
         printf("Father's Day: June %lld%s, %lld\n",d,s,y);
     }
       else if(rq>=father[i-1] && rq<mother[i])
       { 
           d=mother[i]%100;
           y=mother[i]/10000;
         if(d==1 || d==21 || d==31 ) {s[0]='s';s[1]='t';}
        else if(d==2 || d==22 || d==32 ) {s[0]='n';s[1]='d';}
        else if(d==3 || d==23 || d== 33 ) {s[0]='r';s[1]='d';}
        else 
        {s[0]='t';
        s[1]='h';
         }
        printf("Mother's Day: May %lld%s, %lld\n",d,s,y);}
        }
    }

    }
    return 0;
}
全部评论
手动打表,兄弟你这真是一个一个日子对照着日历输的吗...想想都可怕
点赞 回复 分享
发布于 2020-04-18 22:10

相关推荐

不知道怎么取名字_:两个方向 1.简历针对性准备下 2.面试前也需要准备的 主要还是要看各个公司需求,看公司行业和岗位描述,那里面已经写了对技术的需求,一份简历,不可能和所有嵌入式岗位都匹配的
投递北京经纬恒润科技股份有限公司等公司6个岗位
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务