| ||||||||||
| 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 | |||||||||
那位高手能否指点一下阿,怎么老是wrong anwser???郁闷阿!!!// 1008.cpp : Defines the entry point for the console application.
//
#include"iostream"
#include"string.h"
#include"stdio.h"
using namespace std;
int main(int argc, char* argv[])
{
int n,id,iy,month;
int *dp,*yp;
char haab[20][7]={"pop","no","zip","zotz", "tzec", "xul", "yoxkin","mol", "chen",
"yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"};
char tzolkin[21][9]={"imix","ik","akbal","kan","chicchan", "cimi", "manik", "lamat",
"muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac",
"ahau"} ;
char (*mp)[7],im[7];
int temp1,temp2,temp3,k=0;
cin>>n;
mp=new char[n][7];//Do remember to delete cp
dp=new int[n];//Do remember to delete dp
yp=new int[n];//Do remember to delete yp
for(int i=0;i<n;i++) //user input
{
scanf("%d. %s %d",&id,&im,&iy);
if(iy>=5000) //iy should be smaller than 5000
continue;
for(int j=0;j<19;j++)
if(strcmp(im,haab[j])==0)
{
month=j;
break;
}
if(j==19&&month!=j)
continue;
temp1=iy*365+month*20+id+1;
yp[k]=(temp1%260==0?temp1/260-1:temp1/260);
temp2=temp1%260;
temp3=temp2%20-1;
dp[k] =((temp2%13)!=0?(temp2%13):13);
if(temp3>=0)
strcpy(mp[k],tzolkin[temp3]);
else
strcpy(mp[i],"ahau");
k++;
}
cout<<n<<endl;//output
for( i=0;i<k;i++)
cout<<dp[i]<<" "<<mp[i]<<" "<<yp[i]<<endl;
delete[] mp;
delete[] dp;
delete[] yp;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator