POJ 1008 Maya Calendar

思路:先求第一个的天数,然后用这个天数求第二个的表示方式,个人觉得不是水题
#include < stdio.h >
#include
< string .h >
char  hm[ 19 ][ 7 ] = { " pop " , " no " , " zip " , " zotz " , " tzec " , " xul " , " yoxkin " , " mol " , " chen " , " yax " ,
                
" zac " , " ceh " , " mac " , " kankin " , " muan " , " pax " , " koyab " , " cumhu " , " uayet " };
char  tm[ 20 ][ 9 ] = { " imix " , " ik " , " akbal " , " kan " , " chicchan " , " cimi " , " manik " , " lamat " , " muluk " , " ok " ,
                
" chuen " , " eb " , " ben " , " ix " , " mem " , " cib " , " caban " , " eznab " , " canac " , " ahau " };
int  main()
{
    
int  i,m,n,day,year;
    
char  month[ 9 ];    
    scanf(
" %d " , & n);
    printf(
" %d\n " ,n);
    
    
while  (n -- )
    {
        scanf(
" %d.%s%d " , & day,month, & year);
        
for (i = 0 ; i < 19 ; i ++ )
            
if (strcmp(hm[i],month)  ==   0 )
            {
                m
= 365 * year + 20 * i + day;
                
break ;
            }
        printf(
" %d %s %d\n " ,m % 260 % 13 + 1 ,tm[m % 20 ],m / 260 );
    }
    
return   0 ;
}

你可能感兴趣的:(POJ 1008 Maya Calendar)