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


fionahung0908 (username)

School : 臺北市私立延平高級中學
ID : 69055
IP address : [203.72.178.252]
Last Login :
2018-12-19 17:14:26
c638. 天干地支 -- it's david | From: [203.72.178.252] | Post Date : 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++ 與我)

School : 臺北市私立薇閣高級中學
ID : 82132
IP address : [210.243.39.11]
Last Login :
2019-06-13 14:50:22
c638. 天干地支 -- it's david | From: [223.136.185.164] | Post Date : 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