记录编号 287784 评测结果 AAAAAAAAAA
题目名称 到天宫做客 最终得分 100
用户昵称 Gravataropen the window 是否通过 通过
代码语言 C++ 运行时间 0.006 s
提交时间 2016-08-02 14:11:12 内存使用 0.32 MiB
显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
double ans,tot=-9999;
int m[1001],d[1001],n,top,dop;
int p[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main()
{
	freopen("heaven.in","r",stdin);
	freopen("heaven.out","w",stdout);
	scanf("%d",&n);
	for (int i=1; i<=n; ++i) scanf("%d%d",&m[i],&d[i]);
	for (int i=1; i<n; ++i)	 
	 for (int j=i+1; j<=n; ++j)	 
	 if (m[i]>m[j])	 
	 {	 	
	    swap(m[i],m[j]);	 	
		swap(d[i],d[j]);	 
	 }	 
	 else if (m[i]==m[j] && d[i]>d[j]) swap(d[i],d[j]);
	m[0]=1; 
	d[0]=0;
	m[n+1]=12; 
	d[n+1]=32;
	for (int i=0; i<=n; ++i)
	{
		ans=0; 
		top=m[i];
		dop=d[i];
		if (top!=m[i+1])
		{
			ans+=p[top]-dop+1;
			top++;
			dop=1;
			while (top<m[i+1]) 
			{
			   ans+=p[top];
			   top++;
			}
		}
	    ans+=d[i+1]-dop-1;
		//cout<<ans<<endl;
		tot=max(tot,ans*24*60*60/366);
	}
	printf("%.0lf\n",tot);
	fclose(stdin); fclose(stdout); 
}