Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

水过,贴码供参考。。格式很重要!!!!!

Posted by 20101289 at 2012-04-06 08:21:50 on Problem 1008
#include<iostream>
using namespace std;
struct Node{

	int num;
	char name[9];
};
struct Hmonth{
	char mn[8];
	int mnum;
};
int main(void)
{	int n,day,year,i,j,mn;
	char dot,month[8];
	int save[1000][2];
	char *savem[10];
	Hmonth mon[19]=
	{
		{"pop",1},{ "no",2},{ "zip",3},{ "zotz",4},{ "tzec",5} ,{"xul",6},{ "yoxkin",7},{ "mol",8},{ "chen",9} ,
		{"yax",10},{ "zac",11},{ "ceh",12},{ "mac",13},{ "kankin",14},{ "muan",15},{ "pax",16},{ "koyab",17},{ "cumhu",18},{"uayet",19}
		
	};
	Node date[260] = {{1,"imix"},
{2,"ik"},{3,"akbal"},{4,"kan"},{5,"chicchan"},{6,"cimi"},{7,"manik"},{8,"lamat"},{9,"muluk"},{10,"ok"},{11,"chuen"},{12,"eb"},{13,"ben"},{1,"ix"},{2,"mem"},
{3,"cib"},{4,"caban"},{5,"eznab"},{6,"canac"},{7,"ahau"},{8,"imix"},{9,"ik"},{10,"akbal"},{11,"kan"},{12,"chicchan"},{13,"cimi"},{1,"manik"},{2,"lamat"},
{3,"muluk"},{4,"ok"},{5,"chuen"},{6,"eb"},{7,"ben"},{8,"ix"},{9,"mem"},{10,"cib"},{11,"caban"},{12,"eznab"},{13,"canac"},{1,"ahau"},{2,"imix"},{3,"ik"},{4,"akbal"},
{5,"kan"},{6,"chicchan"},{7,"cimi"},{8,"manik"},{9,"lamat"},{10,"muluk"},{11,"ok"},{12,"chuen"},{13,"eb"},{1,"ben"},{2,"ix"},{3,"mem"},{4,"cib"},{5,"caban"},
{6,"eznab"},{7,"canac"},{8,"ahau"},{9,"imix"},{10,"ik"},{11,"akbal"},{12,"kan"},{13,"chicchan"},{1,"cimi"},{2,"manik"},{3,"lamat"},{4,"muluk"},{5,"ok"},{6,"chuen"},
{7,"eb"},{8,"ben"},{9,"ix"},{10,"mem"},{11,"cib"},{12,"caban"},{13,"eznab"},{1,"canac"},{2,"ahau"},{3,"imix"},{4,"ik"},{5,"akbal"},{6,"kan"},{7,"chicchan"},
{8,"cimi"},{9,"manik"},{10,"lamat"},{11,"muluk"},{12,"ok"},{13,"chuen"},{1,"eb"},{2,"ben"},{3,"ix"},{4,"mem"},{5,"cib"},{6,"caban"},{7,"eznab"},{8,"canac"},
{9,"ahau"},{10,"imix"},{11,"ik"},{12,"akbal"},{13,"kan"},{1,"chicchan"},{2,"cimi"},{3,"manik"},{4,"lamat"},{5,"muluk"},{6,"ok"},{7,"chuen"},{8,"eb"},{9,"ben"},
{10,"ix"},{11,"mem"},{12,"cib"},{13,"caban"},{1,"eznab"},{2,"canac"},{3,"ahau"},{4,"imix"},{5,"ik"},{6,"akbal"},{7,"kan"},{8,"chicchan"},{9,"cimi"},{10,"manik"},
{11,"lamat"},{12,"muluk"},{13,"ok"},{1,"chuen"},{2,"eb"},{3,"ben"},{4,"ix"},{5,"mem"},{6,"cib"},{7,"caban"},{8,"eznab"},{9,"canac"},{10,"ahau"},{11,"imix"},
{12,"ik"},{13,"akbal"},{1,"kan"},{2,"chicchan"},{3,"cimi"},{4,"manik"},{5,"lamat"},{6,"muluk"},{7,"ok"},{8,"chuen"},{9,"eb"},{10,"ben"},{11,"ix"},{12,"mem"},
{13,"cib"},{1,"caban"},{2,"eznab"},{3,"canac"},{4,"ahau"},{5,"imix"},{6,"ik"},{7,"akbal"},{8,"kan"},{9,"chicchan"},{10,"cimi"},{11,"manik"},{12,"lamat"},
{13,"muluk"},{1,"ok"},{2,"chuen"},{3,"eb"},{4,"ben"},{5,"ix"},{6,"mem"},{7,"cib"},
{8,"caban"},{9,"eznab"},{10,"canac"},{11,"ahau"},{12,"imix"},{13,"ik"},{1,"akbal"},{2,"kan"},{3,"chicchan"},{4,"cimi"},{5,"manik"},{6,"lamat"},{7,"muluk"},{8,"ok"},
{9,"chuen"},{10,"eb"},{11,"ben"},{12,"ix"},{13,"mem"},{1,"cib"},{2,"caban"},{3,"eznab"},{4,"canac"},{5,"ahau"},{6,"imix"},{7,"ik"},{8,"akbal"},{9,"kan"},
{10,"chicchan"},{11,"cimi"},{12,"manik"},{13,"lamat"},{1,"muluk"},{2,"ok"},{3,"chuen"},{4,"eb"},{5,"ben"},{6,"ix"},{7,"mem"},{8,"cib"},{9,"caban"},{10,"eznab"},
{11,"canac"},{12,"ahau"},{13,"imix"},{1,"ik"},{2,"akbal"},{3,"kan"},{4,"chicchan"},{5,"cimi"},{6,"manik"},{7,"lamat"},{8,"muluk"},{9,"ok"},{10,"chuen"},{11,"eb"},
{12,"ben"},{13,"ix"},{1,"mem"},{2,"cib"},{3,"caban"},{4,"eznab"},{5,"canac"},{6,"ahau"},{7,"imix"},{8,"ik"},{9,"akbal"},{10,"kan"},{11,"chicchan"},{12,"cimi"},
{13,"manik"},{1,"lamat"},{2,"muluk"},{3,"ok"},{4,"chuen"},{5,"eb"},{6,"ben"},{7,"ix"},{8,"mem"},{9,"cib"},{10,"caban"},{11,"eznab"},{12,"canac"},{13,"ahau"}
	};
	
	cin>>n;
	cout<<n<<endl;
	for(i = 0;i<n;i++)
	{
		cin>>day;
		cin>>dot;
		cin>>month;
		cin>>year;
		int total=0;
		int k;
		for( k =0;k<18;k++)
			if(strcmp(month,mon[k].mn )==0)
				break;
			total = year*365+(mon[k].mnum-1)*20+day;		
		save[i][1]=total/260;//year
	
		day = total%260;
		save[i][0]=date[day].num;
		strcpy(*(savem+i)=new char [10],date[day].name);

		cout<<save[i][0]<<" ";
		cout<<*(savem+i);
		delete *(savem+i);
	
	cout<<" "<<save[i][1]<<endl;
	}
	
return 0;}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator