#14742: 請幫忙看哪裡錯了 謝謝


fionahung0908 (username)

學校 : 臺北市私立延平高級中學
編號 : 69055
來源 : [180.217.99.153]
最後登入時間 :
2020-10-19 15:02:55
c638. 天干地支 -- it's david | From: [203.72.178.252] | 發表日期 : 2018-08-02 13:30

#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int n;
string s[]={"戌","酉","申","未","午","巳","辰","卯","寅","丑","子","亥"};
string m[]={"癸","甲","乙","丙","丁","戊","己","庚","辛","壬"};
while(cin>>n)
{
int y=n%12; cout<<m[y];
int i=n%10; cout<<s[i]<<endl;
}
}

 
#15130: Re:請幫忙看哪裡錯了 謝謝


wish.rirf@gmail.com (C++ 與我)

學校 : 臺北市私立薇閣高級中學
編號 : 82132
來源 : [36.224.41.96]
最後登入時間 :
2021-08-07 19:29:31
c638. 天干地支 -- it's david | From: [223.136.185.164] | 發表日期 : 2018-09-15 15:24

#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int n;
string s[]={"戌","酉","申","未","午","巳","辰","卯","寅","丑","子","亥"};
string m[]={"癸","甲","乙","丙","丁","戊","己","庚","辛","壬"};
while(cin>>n)
{
int y=n%12; cout<<m[y];
int i=n%10; cout<<s[i]<<endl;
}
}

西元0年又不是甲子,你要有個基準

 
ZeroJudge Forum