QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#220858 | #7176. I Flipped The Calendar... | 123456qwe | AC ✓ | 1ms | 5796kb | C++14 | 1.1kb | 2023-10-20 21:53:08 | 2023-10-20 21:53:08 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
const int N=1e6+10;
ll rn[N],fid[N];
void solved()
{
for (int i=1970;i<=2037;i++)
{
if (i%4==0&&i%100!=0||i%400==0) rn[i]=1;
}
ll fir=7;
for (int i=2023;i<=2037;i++)
{
fid[i]=fir;
if (rn[i]) fir=(fir+2)%7;
else fir=(fir+1)%7;
if (fir==0) fir=7;
}
fir=7;
for (int i=2023;i>=1970;i--)
{
fid[i]=fir;
if (rn[i-1]) fir=(fir+7-2)%7;
else fir=(fir+7-1)%7;
if (fir==0) fir=7;
}
ll n;cin>>n;
ll yue[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
if (rn[n]) yue[2]=29;
else yue[2]=28;
ll ans=0;
for (int i=1;i<=12;i++)
{
ll x=(fid[n]+yue[i]-1)/7+((fid[n]+yue[i]-1)%7!=0)*1;
// cout<<x<<"-------------------\n";
ans+=x;
fid[n]=(fid[n]+yue[i]-1+1)%7;
if (fid[n]==0) fid[n]=7;
}
cout<<ans<<"\n";
}
int main()
{
// for (int i=7;i<=10000;i+=365)
// {
// ll x=i%7;
// if (x==0) x=7;
// cout<<x<<"\n";
// }
// cout<<365%7<<" "<<366%7;
// ll t;cin>>t;
// while(t--)
solved();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 5644kb
input:
2023
output:
63
result:
ok 1 number(s): "63"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5696kb
input:
1970
output:
63
result:
ok 1 number(s): "63"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5724kb
input:
1971
output:
61
result:
ok 1 number(s): "61"
Test #4:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
1972
output:
63
result:
ok 1 number(s): "63"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
1973
output:
63
result:
ok 1 number(s): "63"
Test #6:
score: 0
Accepted
time: 1ms
memory: 5708kb
input:
1974
output:
62
result:
ok 1 number(s): "62"
Test #7:
score: 0
Accepted
time: 1ms
memory: 5792kb
input:
1975
output:
62
result:
ok 1 number(s): "62"
Test #8:
score: 0
Accepted
time: 1ms
memory: 5716kb
input:
1976
output:
62
result:
ok 1 number(s): "62"
Test #9:
score: 0
Accepted
time: 1ms
memory: 5792kb
input:
1977
output:
63
result:
ok 1 number(s): "63"
Test #10:
score: 0
Accepted
time: 1ms
memory: 5792kb
input:
1978
output:
63
result:
ok 1 number(s): "63"
Test #11:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
1979
output:
63
result:
ok 1 number(s): "63"
Test #12:
score: 0
Accepted
time: 1ms
memory: 5644kb
input:
1980
output:
62
result:
ok 1 number(s): "62"
Test #13:
score: 0
Accepted
time: 1ms
memory: 5644kb
input:
1981
output:
63
result:
ok 1 number(s): "63"
Test #14:
score: 0
Accepted
time: 1ms
memory: 5772kb
input:
1982
output:
61
result:
ok 1 number(s): "61"
Test #15:
score: 0
Accepted
time: 1ms
memory: 5776kb
input:
1983
output:
63
result:
ok 1 number(s): "63"
Test #16:
score: 0
Accepted
time: 0ms
memory: 5728kb
input:
1984
output:
64
result:
ok 1 number(s): "64"
Test #17:
score: 0
Accepted
time: 1ms
memory: 5648kb
input:
1985
output:
62
result:
ok 1 number(s): "62"
Test #18:
score: 0
Accepted
time: 0ms
memory: 5712kb
input:
1986
output:
62
result:
ok 1 number(s): "62"
Test #19:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
1987
output:
63
result:
ok 1 number(s): "63"
Test #20:
score: 0
Accepted
time: 1ms
memory: 5768kb
input:
1988
output:
62
result:
ok 1 number(s): "62"
Test #21:
score: 0
Accepted
time: 0ms
memory: 5716kb
input:
1989
output:
63
result:
ok 1 number(s): "63"
Test #22:
score: 0
Accepted
time: 1ms
memory: 5648kb
input:
1990
output:
63
result:
ok 1 number(s): "63"
Test #23:
score: 0
Accepted
time: 0ms
memory: 5788kb
input:
1991
output:
62
result:
ok 1 number(s): "62"
Test #24:
score: 0
Accepted
time: 1ms
memory: 5644kb
input:
1992
output:
63
result:
ok 1 number(s): "63"
Test #25:
score: 0
Accepted
time: 1ms
memory: 5768kb
input:
1993
output:
61
result:
ok 1 number(s): "61"
Test #26:
score: 0
Accepted
time: 0ms
memory: 5712kb
input:
1994
output:
63
result:
ok 1 number(s): "63"
Test #27:
score: 0
Accepted
time: 0ms
memory: 5712kb
input:
1995
output:
63
result:
ok 1 number(s): "63"
Test #28:
score: 0
Accepted
time: 1ms
memory: 5796kb
input:
1996
output:
62
result:
ok 1 number(s): "62"
Test #29:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
1997
output:
62
result:
ok 1 number(s): "62"
Test #30:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
1998
output:
63
result:
ok 1 number(s): "63"
Test #31:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
1999
output:
61
result:
ok 1 number(s): "61"
Test #32:
score: 0
Accepted
time: 1ms
memory: 5772kb
input:
2000
output:
63
result:
ok 1 number(s): "63"
Test #33:
score: 0
Accepted
time: 1ms
memory: 5772kb
input:
2001
output:
63
result:
ok 1 number(s): "63"
Test #34:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
2002
output:
62
result:
ok 1 number(s): "62"
Test #35:
score: 0
Accepted
time: 1ms
memory: 5784kb
input:
2003
output:
62
result:
ok 1 number(s): "62"
Test #36:
score: 0
Accepted
time: 1ms
memory: 5660kb
input:
2004
output:
62
result:
ok 1 number(s): "62"
Test #37:
score: 0
Accepted
time: 1ms
memory: 5792kb
input:
2005
output:
63
result:
ok 1 number(s): "63"
Test #38:
score: 0
Accepted
time: 1ms
memory: 5704kb
input:
2006
output:
63
result:
ok 1 number(s): "63"
Test #39:
score: 0
Accepted
time: 1ms
memory: 5768kb
input:
2007
output:
63
result:
ok 1 number(s): "63"
Test #40:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
2008
output:
62
result:
ok 1 number(s): "62"
Test #41:
score: 0
Accepted
time: 1ms
memory: 5732kb
input:
2009
output:
63
result:
ok 1 number(s): "63"
Test #42:
score: 0
Accepted
time: 1ms
memory: 5776kb
input:
2010
output:
61
result:
ok 1 number(s): "61"
Test #43:
score: 0
Accepted
time: 1ms
memory: 5696kb
input:
2011
output:
63
result:
ok 1 number(s): "63"
Test #44:
score: 0
Accepted
time: 1ms
memory: 5708kb
input:
2012
output:
64
result:
ok 1 number(s): "64"
Test #45:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
2013
output:
62
result:
ok 1 number(s): "62"
Test #46:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
2014
output:
62
result:
ok 1 number(s): "62"
Test #47:
score: 0
Accepted
time: 1ms
memory: 5720kb
input:
2015
output:
63
result:
ok 1 number(s): "63"
Test #48:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
2016
output:
62
result:
ok 1 number(s): "62"
Test #49:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
2017
output:
63
result:
ok 1 number(s): "63"
Test #50:
score: 0
Accepted
time: 1ms
memory: 5780kb
input:
2018
output:
63
result:
ok 1 number(s): "63"
Test #51:
score: 0
Accepted
time: 1ms
memory: 5716kb
input:
2019
output:
62
result:
ok 1 number(s): "62"
Test #52:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
2020
output:
63
result:
ok 1 number(s): "63"
Test #53:
score: 0
Accepted
time: 1ms
memory: 5704kb
input:
2021
output:
61
result:
ok 1 number(s): "61"
Test #54:
score: 0
Accepted
time: 1ms
memory: 5716kb
input:
2022
output:
63
result:
ok 1 number(s): "63"
Test #55:
score: 0
Accepted
time: 1ms
memory: 5708kb
input:
2024
output:
62
result:
ok 1 number(s): "62"
Test #56:
score: 0
Accepted
time: 1ms
memory: 5716kb
input:
2025
output:
62
result:
ok 1 number(s): "62"
Test #57:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
2026
output:
63
result:
ok 1 number(s): "63"
Test #58:
score: 0
Accepted
time: 0ms
memory: 5780kb
input:
2027
output:
61
result:
ok 1 number(s): "61"
Test #59:
score: 0
Accepted
time: 1ms
memory: 5648kb
input:
2028
output:
63
result:
ok 1 number(s): "63"
Test #60:
score: 0
Accepted
time: 1ms
memory: 5716kb
input:
2029
output:
63
result:
ok 1 number(s): "63"
Test #61:
score: 0
Accepted
time: 1ms
memory: 5624kb
input:
2030
output:
62
result:
ok 1 number(s): "62"
Test #62:
score: 0
Accepted
time: 1ms
memory: 5708kb
input:
2031
output:
62
result:
ok 1 number(s): "62"
Test #63:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
2032
output:
62
result:
ok 1 number(s): "62"
Test #64:
score: 0
Accepted
time: 0ms
memory: 5704kb
input:
2033
output:
63
result:
ok 1 number(s): "63"
Test #65:
score: 0
Accepted
time: 1ms
memory: 5772kb
input:
2034
output:
63
result:
ok 1 number(s): "63"
Test #66:
score: 0
Accepted
time: 0ms
memory: 5788kb
input:
2035
output:
63
result:
ok 1 number(s): "63"
Test #67:
score: 0
Accepted
time: 0ms
memory: 5644kb
input:
2036
output:
62
result:
ok 1 number(s): "62"
Test #68:
score: 0
Accepted
time: 1ms
memory: 5708kb
input:
2037
output:
63
result:
ok 1 number(s): "63"
Extra Test:
score: 0
Extra Test Passed