QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#220210#7176. I Flipped The Calendar...BILLION_mengyiAC ✓1ms3724kbC++201.6kb2023-10-19 23:32:082023-10-19 23:32:09

Judging History

你现在查看的是最新测评结果

  • [2023-10-19 23:32:09]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3724kb
  • [2023-10-19 23:32:08]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N=1000010;

ll m[20];

void solve()
{
	ll n;
	cin>>n;
	ll now=7;
	ll year=2023;
	while(year<n)
	{
		if((year%4==0&&year%100!=0)||(year%100==0&&year%400==0))
		{
			now+=366;
		}
		else
		{
			now+=365;
		}
		year++;
	}
	
	while(now>=8)
	{
		now-=7;
	}
	ll flag=0;
	while(year>n)
	{
		year--;
		if((year%4==0&&year%100!=0)||(year%100==0&&year%400==0))
		{
			now-=366;
		}
		else
		{
			now-=365;
		}
		flag=1;
	}
	
	while(now<=0)
	{
		now+=7;
	}
	ll ans=0;
//	cout<<ans<<" "<<now<<"wwwwwwww\n"; 
	//if(flag) now--;
	if((n%4==0&&n%100!=0)||(n%100==0&&n%400==0))
	{
		for(ll i=1;i<=12;i++)
		{
			if(now!=1)ans++;
			if(i!=2)
			{
				for(ll j=1;j<=m[i];j++)
				{
					if(now==1) ans++;
					now++;
					if(now>7) now-=7;
				}	
			}
			else
			{
				for(ll j=1;j<=29;j++)
				{
					if(now==1) ans++;
					now++;
					if(now>7) now-=7;
				}
			}
//			cout<<ans<<" "<<now<<"wwwwwwww\n"; 
		}
	}
	else
	{
		for(ll i=1;i<=12;i++)
		{
			if(now!=1)ans++;
			if(i==10)
			{
				ll wwwwww=0;
			}
			for(ll j=1;j<=m[i];j++)
			{
			//	now++;
				if(now==1) ans++;
				now++;
				if(now>7) now-=7;
			}	
//			cout<<ans<<" "<<now<<"wwwwwwww\n"; 
		}
	}
	cout<<ans<<"\n";
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll T=1;
	m[1]=31;
	m[2]=28;
	m[3]=31;
	m[4]=30;
	m[5]=31;
	m[6]=30;
	m[7]=31;
	m[8]=31;
	m[9]=30;
	m[10]=31;
	m[11]=30;
	m[12]=31;
	while(T--)
	{
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3652kb

input:

2023

output:

63

result:

ok 1 number(s): "63"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

1970

output:

63

result:

ok 1 number(s): "63"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1971

output:

61

result:

ok 1 number(s): "61"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1972

output:

63

result:

ok 1 number(s): "63"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

1973

output:

63

result:

ok 1 number(s): "63"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

1974

output:

62

result:

ok 1 number(s): "62"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

1975

output:

62

result:

ok 1 number(s): "62"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

1976

output:

62

result:

ok 1 number(s): "62"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1977

output:

63

result:

ok 1 number(s): "63"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

1978

output:

63

result:

ok 1 number(s): "63"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

1979

output:

63

result:

ok 1 number(s): "63"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1980

output:

62

result:

ok 1 number(s): "62"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1981

output:

63

result:

ok 1 number(s): "63"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1982

output:

61

result:

ok 1 number(s): "61"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1983

output:

63

result:

ok 1 number(s): "63"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1984

output:

64

result:

ok 1 number(s): "64"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

1985

output:

62

result:

ok 1 number(s): "62"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

1986

output:

62

result:

ok 1 number(s): "62"

Test #19:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

1987

output:

63

result:

ok 1 number(s): "63"

Test #20:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1988

output:

62

result:

ok 1 number(s): "62"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

1989

output:

63

result:

ok 1 number(s): "63"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1990

output:

63

result:

ok 1 number(s): "63"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1991

output:

62

result:

ok 1 number(s): "62"

Test #24:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

1992

output:

63

result:

ok 1 number(s): "63"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

1993

output:

61

result:

ok 1 number(s): "61"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1994

output:

63

result:

ok 1 number(s): "63"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1995

output:

63

result:

ok 1 number(s): "63"

Test #28:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1996

output:

62

result:

ok 1 number(s): "62"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1997

output:

62

result:

ok 1 number(s): "62"

Test #30:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

1998

output:

63

result:

ok 1 number(s): "63"

Test #31:

score: 0
Accepted
time: 0ms
memory: 3704kb

input:

1999

output:

61

result:

ok 1 number(s): "61"

Test #32:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

2000

output:

63

result:

ok 1 number(s): "63"

Test #33:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

2001

output:

63

result:

ok 1 number(s): "63"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

2002

output:

62

result:

ok 1 number(s): "62"

Test #35:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2003

output:

62

result:

ok 1 number(s): "62"

Test #36:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2004

output:

62

result:

ok 1 number(s): "62"

Test #37:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

2005

output:

63

result:

ok 1 number(s): "63"

Test #38:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

2006

output:

63

result:

ok 1 number(s): "63"

Test #39:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

2007

output:

63

result:

ok 1 number(s): "63"

Test #40:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2008

output:

62

result:

ok 1 number(s): "62"

Test #41:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

2009

output:

63

result:

ok 1 number(s): "63"

Test #42:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

2010

output:

61

result:

ok 1 number(s): "61"

Test #43:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

2011

output:

63

result:

ok 1 number(s): "63"

Test #44:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2012

output:

64

result:

ok 1 number(s): "64"

Test #45:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

2013

output:

62

result:

ok 1 number(s): "62"

Test #46:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

2014

output:

62

result:

ok 1 number(s): "62"

Test #47:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

2015

output:

63

result:

ok 1 number(s): "63"

Test #48:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

2016

output:

62

result:

ok 1 number(s): "62"

Test #49:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

2017

output:

63

result:

ok 1 number(s): "63"

Test #50:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

2018

output:

63

result:

ok 1 number(s): "63"

Test #51:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

2019

output:

62

result:

ok 1 number(s): "62"

Test #52:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

2020

output:

63

result:

ok 1 number(s): "63"

Test #53:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

2021

output:

61

result:

ok 1 number(s): "61"

Test #54:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

2022

output:

63

result:

ok 1 number(s): "63"

Test #55:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

2024

output:

62

result:

ok 1 number(s): "62"

Test #56:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

2025

output:

62

result:

ok 1 number(s): "62"

Test #57:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

2026

output:

63

result:

ok 1 number(s): "63"

Test #58:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

2027

output:

61

result:

ok 1 number(s): "61"

Test #59:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2028

output:

63

result:

ok 1 number(s): "63"

Test #60:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

2029

output:

63

result:

ok 1 number(s): "63"

Test #61:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2030

output:

62

result:

ok 1 number(s): "62"

Test #62:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2031

output:

62

result:

ok 1 number(s): "62"

Test #63:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2032

output:

62

result:

ok 1 number(s): "62"

Test #64:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

2033

output:

63

result:

ok 1 number(s): "63"

Test #65:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2034

output:

63

result:

ok 1 number(s): "63"

Test #66:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

2035

output:

63

result:

ok 1 number(s): "63"

Test #67:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2036

output:

62

result:

ok 1 number(s): "62"

Test #68:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

2037

output:

63

result:

ok 1 number(s): "63"

Extra Test:

score: 0
Extra Test Passed