#40065: c++ans


yp11251120@yphs.tp.edu.tw (808-43杜波波)

學校 : 臺北市私立延平高級中學
編號 : 237257
來源 : [203.72.178.1]
最後登入時間 :
2024-11-06 17:51:13
c636. 十二生肖 -- it's david | From: [203.72.178.1] | 發表日期 : 2024-04-26 11:30

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string c[12]={"豬","鼠","牛","虎","兔","龍","蛇","馬","羊","猴","雞","狗"};
    string d[12]={"鼠","豬","狗","雞","猴","羊","馬","蛇","龍","兔","虎","牛"};
    int a,b;
    while(cin>>a)
    {
    if(a>0)
    {
    b=a%12;
    cout<<c[b]<<endl;
    }
    if(a<0)
    {
      b=abs(a)%12;
      cout<<d[b]<<endl;
    }   
    }
}

 
ZeroJudge Forum