#include <iostream>
#include <cstring>
using namespace std;
int stTl=20,stTh=28,stHl=30,stHh=60;
struct days
{
int t,h,yn;
}day[10];
struct rules
{
int t,h,yn;
}
rule[10];
int main()
{
for(int x=0;x<5;x++)
{
rule[x].t=0,rule[x].h=0,rule[x].yn=0;
}
day[0].t=2, day[0].h=1, day[0].yn=1;
day[1].t=2, day[1].h=2, day[1].yn=1;
day[2].t=2, day[2].h=1, day[2].yn=1;
day[3].t=3, day[3].h=3, day[3].yn=0;
day[4].t=3, day[4].h=3, day[4].yn=0;
day[5].t=3, day[5].h=3, day[5].yn=0;
day[6].t=3, day[6].h=3, day[6].yn=0;
day[7].t=3, day[7].h=1, day[7].yn=0;
day[8].t=3, day[8].h=2, day[8].yn=0;
day[9].t=1, day[9].h=1, day[9].yn=1;
days td;
td.yn=0;
int n,cnt=0,tt,th;
string a,b,c;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a>>b>>c;
if(a[0]=='T')
{
if(b[0]=='c')rule[i].t=1;
else if(b[0]=='m')rule[i].t=2;
else rule[i].t=3;
}
else
{
if(b[0]=='d')rule[i].h=1;
else if(b[0]=='n')rule[i].h=2;
else rule[i].t=3;
}
if(c[0]=='Y')rule[i].yn=1;
}
//for(int i=0;i<10;i++)
//{
// cout<<day[i].t<<" "<<day[i].h<<" "<<day[i].yn<<endl;
//}
for(int i=0;i<10;i++)
{
for(int j=0;j<n;j++)
{
if(day[i].t==rule[j].t)
{
if(day[i].yn==rule[j].yn)
{
cnt++;
}
break;
}
else if(day[i].h==rule[j].h)
{
if(day[i].yn==rule[j].yn)
{
cnt++;
}
break;
}
//cout<<cnt<<endl;
}
}
cin>>tt>>th;
if(tt<20)td.t=1;
else if(tt<28)td.t=2;
else td.t=3;
if(th<30)td.h=1;
else if(th<60)td.h=2;
else td.h=3;
int x,sum=0;
for(x=0;x<n;x++)
{
if(td.t==rule[x].t)
{
td.yn=rule[x].yn;
sum++;
break;
}
if(td.h==rule[x].h)
{
td.yn=rule[x].yn;
sum++;
break;
}
}
//cout<<x<<" "<<sum<<endl;
//cout<<td.t<<" "<<td.h<<" "<<td.yn<<endl;
cout<<cnt<<endl;
if(sum==0)cout<<0<<endl;
else cout<<x+1<<endl;
if(td.yn==0)cout<<"N"<<endl;
else cout<<"Y"<<endl;
system("pause");
return 0;
}
只有測資4的line2會有問題 WHY?