markdown 在线制作ppt json校验和格式化工具

POJ 1008

using namespace std;
int main(){
int N;
cin>>N;
double *days=(double *)new double[N];
char amonth[7];
int year_day;
char month[19][20]={"pop", "no", "zip", "zotz", "tzec","xul", "yoxkin", "mol", "chen", "yax","zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet" };
int n[13]={1,2,3,4,5,6,7,8,9,10,11,12,13};
char c[20][20]={"imix", "ik", "akbal", "kan", "chicchan","cimi", "manik", "lamat", "muluk", "ok","chuen", "eb", "ben", "ix", "mem","cib", "caban", "eznab", "canac", "ahau" };//字符串这里也遇到了问题;
for(int i=0;i<N;i++){
cin>>days[i];
days[i]+=1;
cin>>amonth;
cin>>year_day;
year_day=(year_day)*365;
int month_day;
for(month_day=0;month_day<19;month_day++)
  if(strcmp(amonth,month[month_day])==0)
      break;
month_day*=20;
days[i]+=(year_day+month_day);
}
//////////////////////////////////////////////////////////
int Tyear;
int num;
cout<<N<<endl;
for(int j=0;j<N;j++){
Tyear=(int)days[j]/260;
num=(int)days[j]%260;
if(num!=0)
cout<<n[(num-1)%13]<<" "<<c[(num-1)%20]<<" "<<Tyear<<endl;
else//这里是我算法的漏洞;{在修改之前}
cout<<13<<" "<<"ahau"<<" "<<Tyear-1<<endl;


}
return 0;
}

 

 

 

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。 

技术网站地址: vmfor.com

posted @ 2015-06-09 13:13  GavinHacker  阅读(155)  评论(0编辑  收藏  举报
markdown 在线制作ppt json校验和格式化工具