本文主要是介绍Codeforces 724A. Checking the Calendar,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
链接http://codeforces.com/problemset/problem/724/A
思路
开始想复杂了.
#include<bits/stdc++.h>
using namespace std;
int main(){int r[3];r[0]=31%7;r[1]=30%7;r[2]=28%7; //3 2 0char m[7][20]={"monday","tuesday","wednesday","thursday","friday","saturday","sunday"};char a[20],b[20];cin>>a>>b;int aa;int bb;for(int i=0;i<7;i++){if(strcmp(m[i],a)==0){aa=i; }if(strcmp(m[i],b)==0){bb=i;}}int ret=(bb-aa)%7;if(ret<0)ret+=7;//printf("ret=%d\n",ret);int i;for(i=0;i<3;i++){if(ret==r[i]){printf("YES\n");break;}} if(i==3)printf("NO\n");return 0; }
这篇关于Codeforces 724A. Checking the Calendar的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!