this is my almost working code for spoj mayca .......can anyone suggest me anytest cases.............for which it is not working.........tnx in advance #include<iostream> #include<cstdio> #include<cstring> using namespace std; char maya[][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; char tzoklin[][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int search(char*x) { for(int i=0;i<20;i++) if(strcmp(x,maya[i])==0) return i; } main() { int t; char a[30]; char b[10]; scanf("%d\n",&t); while(t--) { int d,y; gets(a); sscanf(a,"%d.%s%d",&d,b,&y); int m=search(b); int dt; if(m<18) dt=y*365+search(b)*20+d+1; else dt=y*365+18*20+d+1; int ye=dt/260; int x,p,n; p=dt%260; if(p%13) x=p%13; else x=13; n=p%20; cout<<x<<' '<<tzoklin[n-1]<<' '<<ye<<"\n"; } }
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.