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

why!!!!急救 为什么给出的数据测了都是对的就是WA

Posted by mywnewstart at 2016-03-19 23:08:56 on Problem 1008
#include <iostream>
#include <string>
using namespace std;
string haab[19]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
string tzolkinm[20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
void get(int &d,int &m,int &y)
{
	string s1,s2,l;
	cin>>s1>>s2>>y;
	int i=0,j=0;
	d=0; 
	while (s1[i]!='.')
	{
		d=d*10+s1[i]-'0';
		i++;
	}
	d++;

	for (i=0;i<19;i++) if (s2==haab[i]) m=i+1; 
}

int get_date (int d,int m,int y)
{
	int sum=0;
	sum=y*365;
	sum=sum+(m-1)*20+d; 
	return sum;
}
	
void print(int sum)
{
	int d,m,y;
	y=sum/260;
	sum=sum%260;
	m=sum-(sum/13)*13;
	d=sum-(sum/20)*20;
	if (m==0&&y!=0) m=13;
	if (d==0&&y!=0) d=20;
	if (sum==0&&y>0) y--;
	cout<<m<<' '<<tzolkinm[d-1]<<' '<<y<<endl;
}

int main()
{

	int n,m,d,y,sum;
	cin>>n;
	cout<<n<<endl;

	for (int i=0;i<n;i++)
	{
		get(d,m,y);
		sum=get_date(d,m,y);
		
		print(sum);
	}
	return 0;
}

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