模拟
#include#include #include #include #include using namespace std;const int maxn=100+10;char t1[maxn],t2[maxn];int g1,g2,h1,h2;int main(){ int T; scanf("%d",&T); while(T--) { g1=g2=h1=h2=0; scanf("%s%s",t1,t2); if(t1[2]=='n') g1=1; if(t1[3]=='^') { g1=0; for(int i=4;;i++) { if(t1[i]>='0'&&t1[i]<='9') g1=g1*10+t1[i]-'0'; else break; } } int pos=-1; int len=strlen(t1); for(int i=0;t1[i];i++) { if(i+3 ='0'&&t1[i]<='9') sum=sum*10+t1[i]-'0'; else break; } h1=max(h1,sum); } if(t2[2]=='n') g2=1; if(t2[3]=='^') { g2=0; for(int i=4;;i++) { if(t2[i]>='0'&&t2[i]<='9') g2=g2*10+t2[i]-'0'; else break; } } pos=-1; len=strlen(t2); for(int i=0;t2[i];i++) { if(i+3 ='0'&&t2[i]<='9') sum=sum*10+t2[i]-'0'; else break; } h2=max(h2,sum); } // printf("%d %d\n",g1,h1); // printf("%d %d\n",g2,h2); if(g1 g2) printf("Second\n"); else { if(h1 h2) printf("Second\n"); else printf("Both\n"); } } return 0;}