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

求救:测试数据都对,为什么WA,请各位大牛看下!!!!!!

Posted by ltm5180 at 2010-12-15 15:38:33 on Problem 1008
#include "stdio.h"
#include "stdlib.h"
#include "string.h"

typedef struct {
   int NumberOfTheDay;
   char Month[10];
   float Year;  
}haab;


//enum Name{
  //   imix,ik,akbal,kan,chicchan,cimi,manik,lamat,muluk,ok,chuen,eb,ben,ix,mem,cib,caban,eznab,canac,ahau 
//};

haab h[5001];

int n=0;
//Name NameOfT;

long RankOfYear(int  i) {
    if(!strcmp(h[i].Month,"pop"))
        return h[i].NumberOfTheDay+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"no"))
        return h[i].NumberOfTheDay+20+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"zip"))
        return h[i].NumberOfTheDay+40+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"zotz"))
        return h[i].NumberOfTheDay+60+(long)h[i].Year*365;  
    else if(!strcmp(h[i].Month,"tzec"))
        return h[i].NumberOfTheDay+80+(long)h[i].Year*365; 
    else if(!strcmp(h[i].Month,"xul"))
        return h[i].NumberOfTheDay+100+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"yoxkin"))
        return h[i].NumberOfTheDay+120+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"mol"))
        return h[i].NumberOfTheDay+140+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"chen"))
        return h[i].NumberOfTheDay+160+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"yax"))
        return h[i].NumberOfTheDay+180+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"zac"))
        return h[i].NumberOfTheDay+200+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"ceh"))
        return h[i].NumberOfTheDay+220+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"mac"))
        return h[i].NumberOfTheDay+240+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"kankin"))
        return h[i].NumberOfTheDay+260+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"muan"))
        return h[i].NumberOfTheDay+280+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"pax"))
        return h[i].NumberOfTheDay+300+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"koyab"))
        return h[i].NumberOfTheDay+320+(long)h[i].Year*365;
    else if(!strcmp(h[i].Month,"cumhu"))
        return h[i].NumberOfTheDay+340+(long)h[i].Year*365;
    else
        return h[i].NumberOfTheDay+360+(long)h[i].Year*365;
} 

int ftoi(int i) {
    if(  (float)(h[i].Year*365/260)-(long)(h[i].Year*365/260) )
        return h[i].Year*365/260+1;
    else
        return h[i].Year*365/260;
}

void transfer(long Rank,int i) {
    
    switch( Rank%20  ) {
      case 0: printf("%d imix %d\n",Rank%13+1,ftoi(i));break;
      case 1: printf("%d ik %d\n",Rank%13+1,ftoi(i));break;
      case 2: printf("%d akbal %d\n",Rank%13+1,ftoi(i));break;
      case 3: printf("%d kan %d\n",Rank%13+1,ftoi(i));break;
      case 4: printf("%d chicchan %d\n",Rank%13+1,ftoi(i));break;
      case 5: printf("%d cimi %d\n",Rank%13+1,ftoi(i));break;
      case 6: printf("%d manik %d\n",Rank%13+1,ftoi(i));break;
      case 7: printf("%d lamat %d\n",Rank%13+1,ftoi(i));break;
      case 8: printf("%d muluk %d\n",Rank%13+1,ftoi(i));break;
      case 9: printf("%d ok %d\n",Rank%13+1,ftoi(i));break;
      case 10: printf("%d chuen %d\n",Rank%13+1,ftoi(i));break;
      case 11: printf("%d eb %d\n",Rank%13+1,ftoi(i));break;
      case 12: printf("%d ben %d\n",Rank%13+1,ftoi(i));break;
      case 13: printf("%d ix %d\n",Rank%13+1,ftoi(i));break;
      case 14: printf("%d mem %d\n",Rank%13+1,ftoi(i));break;
      case 15: printf("%d cib %d\n",Rank%13+1,ftoi(i));break;
      case 16: printf("%d caban %d\n",Rank%13+1,ftoi(i));break;
      case 17: printf("%d eznab %d\n",Rank%13+1,ftoi(i));break;
      case 18: printf("%d canac %d\n",Rank%13+1,ftoi(i));break;
      case 19: printf("%d ahau %d\n",Rank%13+1,ftoi(i));break;
    }
}

void solve(int i) {
    
    transfer(RankOfYear(i),i);           
}

int main() {
    char c;
    scanf("%d",&n);
    printf("%d\n",n);
    for(int i=0;i<n;i++) 
    { scanf("%d%c %s %f",&h[i].NumberOfTheDay,&c,h[i].Month,&h[i].Year);
      solve(i);
    }
    system("pause");
    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