| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
总是Runtime Error 时间复杂度都这么低了……谁帮帮忙 看看
#include<stdio.h>
#include<string.h>
#define Max 20
char haab[19][Max]={
"pop", "no", "zip", "zotz", "tzec",
"xul", "yoxkin", "mol", "chen", "yax",
"zac", "ceh", "mac", "kankin", "muan",
"pax", "koyab", "cumhu", "uayet" };
char tzolkin[20][Max]={
"imix", "ik", "akbal", "kan", "chicchan",
"cimi", "manik", "lamat", "muluk", "ok",
"chuen", "eb", "ben", "ix", "mem",
"cib", "caban", "eznab", "canac", "ahau" };
typedef struct
{
int num;
int mon;
int year;
}Tzolkin;
void main()
{
int i,j,n,total,day,month,year;
char mon[Max];
Tzolkin tz[Max];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d.%s %d",&day,mon,&year);
for(month=0;month<19 && strcmp(mon,haab[month])!=0;month++){}
total=year*365+month*20+day;
tz[i].year=total/260;
total%=260;
tz[i].num=total%13+1;
tz[i].mon=total%20;
}
printf("%d\n",n);
for(i=0;i<n;i++)
printf("%d %s %d\n",tz[i].num,tzolkin[tz[i].mon],tz[i].year);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator