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

Re:留念一下,不知道错哪里了?

Posted by 36042819900919291x at 2009-12-09 16:19:40 on Problem 1005
In Reply To:留念一下 Posted by:Godwind at 2009-09-10 15:38:40
#include<iostream>
#include<string>
using namespace std;
struct Haab
{ int day;
  char * month;
  int year;
};
struct Tzolkin
{ int day;
  char * month;
  int year;
};
 int  main ()
 { char* Hb[19]={ "pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen",
                   "yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
   
   char* Tn[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat",
                    "muluk","ok","chuen","eb","ben","ix","mem",
                    "cib","caban","eznab","canac","ahau"};
 
  int n,m,tem;
  cin >> n;
  
  Tzolkin* b=new Tzolkin[n];
  for ( int i =0;i<n;i++)
  { int D,Y,sumD;
    char X;
    char * mon=new char[10];
	cin >> D;
	while( cin >> X )
		if( X =='.') 
		{ cin >> mon;
		   break;
		}
	cin >> Y;
	
	for (int j=0;j<19;j++)
	{ tem = strcmp(mon,Hb[j]);
		if( tem == 0 ) 
	  m=j ;
	}
	sumD = Y*365 + 20*(m) +D+1;
	cout << sumD <<endl;
    b[i].year = sumD/260 ;
	int temp= sumD%260%20 ;
	if( temp ==0 ) temp=20;
	                    
	b[i].month = new char[10];
    strcpy(b[i].month ,Tn[temp-1]);
	if(sumD%260%13==0)
	b[i].day=13;
	b[i].day = sumD%260%13;
    delete []mon;
	}
   cout << i << endl;
  for( i=0;i<n;i++)
  cout << b[i].day <<" "<< b[i].month <<" "<< b[i].year <<endl;
  return 1;
  delete []b;
  }	 
  
 

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