链接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 0
char 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;
}