Amy and Tom are arguing about what day is today. Their conversations are as the following:
Amy: Today is Friday.
Tom: No! Today is Saturday.
Amy: But Wednesday was yesterday.
Tom: No way! Yesterday was Thursday.
Amy: Then tomorrow must be Tuesday.
Tom: Are you kidding? It's Monday tomorrow.
Now their mother tells you that each of them has said only one thing correct. It's your job to tell exactly what day is today.
Input Specification:
Each input file contains one test case. Each case consists of 2 lines, each gives the claims of a kid, in the following format:
yesterday today tomorrow
where the days are represented by numbers from 0 to 6, corresponding to Sunday through Saturday.
Output Specification:
First output in a line the English name for "today". It is guaranteed that each kid has said only one thing correct, and there is a unique answer for "today".
Then in the next two lines, print in order the correct days (either yesterday
or today
, or tomorrow
) obtained from the kids.
Sample Input:
3 5 2
4 6 1
Sample Output:
Friday
today
yesterday
Note: The English names for the days are
0 - Sunday
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday
#include<iostream>
using namespace std;
int yes[] = {6,0,1,2,3,4,5};
int tom[] = {1,2,3,4,5,6,0};
string day[] = {"yesterday","today","tomorrow"};
string week[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int person[3][4];
int a[4],b[4];
int main(){
cin>>a[0]>>a[1]>>a[2]>>b[0]>>b[1]>>b[2];
for(int i = 0;i<7;i++){
int c1 = 0,c2 = 0,r1,r2;
if(a[0]==yes[i]) c1++,r1 = 0;
if(a[1]==i) c1++,r1 = 1;
if(a[2]==tom[i])c1++,r1 = 2;
if(b[0]==yes[i])c2++,r2 = 0;
if(b[1]==i)c2++,r2 = 1;
if(b[2]==tom[i]) c2++,r2 = 2;
if(c1==1&&c2==1){
cout<<week[i]<<endl;
cout<<day[r1]<<endl;
cout<<day[r2]<<endl;
return 0;
}
}
}