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<iostream> #include<string> #include<string.h> using namespace std; bool equal(char *s1, char *s2){ int i = 0; while((s1[i] == s2[i])&& (s1[i] != '\0')){ ++i; } if((s1[i] == '\0')&& (s2[i] == '\0')){ return true; }else{ return false; } } struct node{ int year; int month; int day; node(int i = 0, int j = 0, int k = 0){ year = i; month = j; day = k; } }; int days(int day, char *month, int year){ char *s[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"}; int m = 0; while(!equal(month, s[m])){ ++m; } int days = m*20 + day + 365*year + 1; return days; } node print(int days){ int year = days/260; int flag = 0; if(year*260 == days){ year = year - 1; flag = 1; } int day; int num; if(flag){ day = 19; num = 13; }else{ day = ((days - 260*year)%20 - 1); num = (days - 260*year)%13; } if(num == 0){ num = 13; } node p; p.day = num; p.year = year; p.month = day; return p; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator