测试
测试
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
map<string,int> mp;
int main()
{
mp[“rat”]=1;mp[“ox”]=2;mp[“tiger”]=3;mp[“rabbit”]=4;mp[“dragon”]=5;mp[“snake”]=6;
mp[“horse”]=7;mp[“sheep”]=8;mp[“monkey”]=9;mp[“rooster”]=10;mp[“dog”]=11;mp[“pig”]=12;
int n;
string str1,str2;
cin>>n;
while(n–)
{
cin>>str1>>str2;
int ans=abs(12+mp[str2]-mp[str1]);
int ans1=abs(12+mp[str2]-mp[str1]);
ans=min(ans,ans1);
if(ans==0) ans=12;
if(ans>12) ans-=12;
cout<<ans<<endl;
}
return 0;
}