#40066: 解法:給崴崴//沒很強


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:35


    string c[12]={"豬","鼠","牛","虎","兔","龍","蛇","馬","羊","猴","雞","狗"};
    string d[12]={"鼠","豬","狗","雞","猴","羊","馬","蛇","龍","兔","虎","牛"};

先開兩個字元陣列然後分成正負數解決

ex:


    if(a>0) b=a%12;

    if(a<0)b=abs(a)%12;
剩下自己用

 
#40258: Re: 解法:給崴崴//沒很強


yp11251056@yphs.tp.edu.tw (808-25林鈺崴)

學校 : 臺北市私立延平高級中學
編號 : 237375
來源 : [203.72.178.1]
最後登入時間 :
2024-11-13 10:29:41
c636. 十二生肖 -- it's david | From: [203.72.178.1] | 發表日期 : 2024-05-03 11:19


    string c[12]={"豬","鼠","牛","虎","兔","龍","蛇","馬","羊","猴","雞","狗"};
    string d[12]={"鼠","豬","狗","雞","猴","羊","馬","蛇","龍","兔","虎","牛"};

先開兩個字元陣列然後分成正負數解決

ex:


    if(a>0) b=a%12;

    if(a<0)b=abs(a)%12;
剩下自己用



 

啊哈哈 謝謝喔 :D

 
ZeroJudge Forum