QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#164746 | #7176. I Flipped The Calendar... | ucup-team1001# | AC ✓ | 2ms | 3556kb | C++17 | 1.7kb | 2023-09-05 13:22:58 | 2023-09-05 13:22:59 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define LL __int128
#define rep(i,l,r) for(ll i = l; l <= r ? i <= r : i >= r;l <= r ? ++i : --i)
#define irep(i,l,r) for(ll i = l; i <= r; ++i)
#define drep(i,r,l) for(ll i = r; i >= l; --i)
#define abs(x) (x > 0 ? x : -x)
#define ceil(pp,qq) ((pp>0)^(qq>0)?-abs(pp)/abs(qq):pp%qq?pp/qq+1:pp/qq)
#define floor(pp,qq) ((pp>0)^(qq>0)?-ceil(abs(pp),abs(qq)):pp/qq)
using namespace std;
inline ll read(){
ll s=0; bool fl = 0;
char chcc=getchar();
while(chcc<'0'||chcc>'9'){if(chcc == '-')fl = 1;chcc = getchar();}
while(chcc>='0'&&chcc<='9') s=(s<<3)+(s<<1)+(chcc^48),chcc=getchar();
return fl?-s:s;
}
inline char rc(){
char readch = getchar();
while(!('0'<= readch && readch <= '9' || 'A' <= readch && readch <= 'Z' || 'a' <= readch && readch <= 'z'))readch = getchar();
return readch;
}
const int N = 500999;
const int mod = 1000000007;
const int itinf = 1000000000;
const long long llinf = 100000000000000000;
int days[120] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int calc(int yy, int mm){
if((yy % 4) || (yy % 4 == 0) && (yy % 400 != 0) && (yy % 100 == 0) )return days[mm];
return mm == 2 ? 29 : days[mm];
}
int main(){
// cout << calc(2020,2);
int r = read();
int yy = 1970, mm = 1, dd = 1, d = 2;
for(yy = 1970; yy < r; ++ yy){
for(mm = 1; mm <= 12; ++ mm){
for(dd = 1; dd <= calc(yy,mm); ++ dd){
++ d;
d %= 7;
// cout << yy <<' '<<mm<<' '<<dd<<' '<<d<<endl;
}
}
}
int ans = 0;
for(mm = 1; mm <= 12; ++ mm){
if(d != 6)++ ans;
for(dd = 1; dd <= calc(r,mm); ++ dd){
++ d;d %= 7;
if(d == 0)++ ans;
// cout << mm <<' '<<dd<<' '<<d <<endl;
}
}
cout << ans;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3488kb
input:
2023
output:
63
result:
ok 1 number(s): "63"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
1970
output:
63
result:
ok 1 number(s): "63"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
1971
output:
61
result:
ok 1 number(s): "61"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
1972
output:
63
result:
ok 1 number(s): "63"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3368kb
input:
1973
output:
63
result:
ok 1 number(s): "63"
Test #6:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
1974
output:
62
result:
ok 1 number(s): "62"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
1975
output:
62
result:
ok 1 number(s): "62"
Test #8:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
1976
output:
62
result:
ok 1 number(s): "62"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
1977
output:
63
result:
ok 1 number(s): "63"
Test #10:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
1978
output:
63
result:
ok 1 number(s): "63"
Test #11:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
1979
output:
63
result:
ok 1 number(s): "63"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
1980
output:
62
result:
ok 1 number(s): "62"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
1981
output:
63
result:
ok 1 number(s): "63"
Test #14:
score: 0
Accepted
time: 1ms
memory: 3300kb
input:
1982
output:
61
result:
ok 1 number(s): "61"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
1983
output:
63
result:
ok 1 number(s): "63"
Test #16:
score: 0
Accepted
time: 1ms
memory: 3296kb
input:
1984
output:
64
result:
ok 1 number(s): "64"
Test #17:
score: 0
Accepted
time: 1ms
memory: 3388kb
input:
1985
output:
62
result:
ok 1 number(s): "62"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
1986
output:
62
result:
ok 1 number(s): "62"
Test #19:
score: 0
Accepted
time: 1ms
memory: 3392kb
input:
1987
output:
63
result:
ok 1 number(s): "63"
Test #20:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
1988
output:
62
result:
ok 1 number(s): "62"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3356kb
input:
1989
output:
63
result:
ok 1 number(s): "63"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3356kb
input:
1990
output:
63
result:
ok 1 number(s): "63"
Test #23:
score: 0
Accepted
time: 0ms
memory: 3300kb
input:
1991
output:
62
result:
ok 1 number(s): "62"
Test #24:
score: 0
Accepted
time: 1ms
memory: 3368kb
input:
1992
output:
63
result:
ok 1 number(s): "63"
Test #25:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
1993
output:
61
result:
ok 1 number(s): "61"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
1994
output:
63
result:
ok 1 number(s): "63"
Test #27:
score: 0
Accepted
time: 0ms
memory: 3364kb
input:
1995
output:
63
result:
ok 1 number(s): "63"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
1996
output:
62
result:
ok 1 number(s): "62"
Test #29:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
1997
output:
62
result:
ok 1 number(s): "62"
Test #30:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
1998
output:
63
result:
ok 1 number(s): "63"
Test #31:
score: 0
Accepted
time: 1ms
memory: 3384kb
input:
1999
output:
61
result:
ok 1 number(s): "61"
Test #32:
score: 0
Accepted
time: 1ms
memory: 3384kb
input:
2000
output:
63
result:
ok 1 number(s): "63"
Test #33:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
2001
output:
63
result:
ok 1 number(s): "63"
Test #34:
score: 0
Accepted
time: 1ms
memory: 3368kb
input:
2002
output:
62
result:
ok 1 number(s): "62"
Test #35:
score: 0
Accepted
time: 0ms
memory: 3380kb
input:
2003
output:
62
result:
ok 1 number(s): "62"
Test #36:
score: 0
Accepted
time: 1ms
memory: 3388kb
input:
2004
output:
62
result:
ok 1 number(s): "62"
Test #37:
score: 0
Accepted
time: 0ms
memory: 3388kb
input:
2005
output:
63
result:
ok 1 number(s): "63"
Test #38:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
2006
output:
63
result:
ok 1 number(s): "63"
Test #39:
score: 0
Accepted
time: 1ms
memory: 3296kb
input:
2007
output:
63
result:
ok 1 number(s): "63"
Test #40:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
2008
output:
62
result:
ok 1 number(s): "62"
Test #41:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
2009
output:
63
result:
ok 1 number(s): "63"
Test #42:
score: 0
Accepted
time: 1ms
memory: 3304kb
input:
2010
output:
61
result:
ok 1 number(s): "61"
Test #43:
score: 0
Accepted
time: 2ms
memory: 3548kb
input:
2011
output:
63
result:
ok 1 number(s): "63"
Test #44:
score: 0
Accepted
time: 1ms
memory: 3360kb
input:
2012
output:
64
result:
ok 1 number(s): "64"
Test #45:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
2013
output:
62
result:
ok 1 number(s): "62"
Test #46:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
2014
output:
62
result:
ok 1 number(s): "62"
Test #47:
score: 0
Accepted
time: 1ms
memory: 3368kb
input:
2015
output:
63
result:
ok 1 number(s): "63"
Test #48:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
2016
output:
62
result:
ok 1 number(s): "62"
Test #49:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
2017
output:
63
result:
ok 1 number(s): "63"
Test #50:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
2018
output:
63
result:
ok 1 number(s): "63"
Test #51:
score: 0
Accepted
time: 1ms
memory: 3360kb
input:
2019
output:
62
result:
ok 1 number(s): "62"
Test #52:
score: 0
Accepted
time: 1ms
memory: 3388kb
input:
2020
output:
63
result:
ok 1 number(s): "63"
Test #53:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
2021
output:
61
result:
ok 1 number(s): "61"
Test #54:
score: 0
Accepted
time: 1ms
memory: 3392kb
input:
2022
output:
63
result:
ok 1 number(s): "63"
Test #55:
score: 0
Accepted
time: 0ms
memory: 3364kb
input:
2024
output:
62
result:
ok 1 number(s): "62"
Test #56:
score: 0
Accepted
time: 1ms
memory: 3392kb
input:
2025
output:
62
result:
ok 1 number(s): "62"
Test #57:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
2026
output:
63
result:
ok 1 number(s): "63"
Test #58:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
2027
output:
61
result:
ok 1 number(s): "61"
Test #59:
score: 0
Accepted
time: 1ms
memory: 3300kb
input:
2028
output:
63
result:
ok 1 number(s): "63"
Test #60:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
2029
output:
63
result:
ok 1 number(s): "63"
Test #61:
score: 0
Accepted
time: 1ms
memory: 3360kb
input:
2030
output:
62
result:
ok 1 number(s): "62"
Test #62:
score: 0
Accepted
time: 1ms
memory: 3300kb
input:
2031
output:
62
result:
ok 1 number(s): "62"
Test #63:
score: 0
Accepted
time: 0ms
memory: 3388kb
input:
2032
output:
62
result:
ok 1 number(s): "62"
Test #64:
score: 0
Accepted
time: 1ms
memory: 3388kb
input:
2033
output:
63
result:
ok 1 number(s): "63"
Test #65:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
2034
output:
63
result:
ok 1 number(s): "63"
Test #66:
score: 0
Accepted
time: 1ms
memory: 3384kb
input:
2035
output:
63
result:
ok 1 number(s): "63"
Test #67:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
2036
output:
62
result:
ok 1 number(s): "62"
Test #68:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
2037
output:
63
result:
ok 1 number(s): "63"
Extra Test:
score: 0
Extra Test Passed