QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#232105#7176. I Flipped The Calendar...ikefumyAC ✓1ms3820kbC++202.8kb2023-10-29 21:31:412023-10-29 21:31:42

Judging History

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

  • [2023-10-29 21:31:42]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3820kb
  • [2023-10-29 21:31:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define ti3 tuple<int,int,int>
#define int128 __int128_t
#define pii128 pair<int128,int128>
const int inf = 1 << 30;
const ll linf = 1e18;
const ll mod = 1e9 + 7;
const db EPS = 1e-10;
const db pi = acos(-1);
template<class T> bool chmin(T& x, T y){
    if(x > y) {
        x = y;
        return true;
    } else return false;
}
template<class T> bool chmax(T& x, T y){
    if(x < y) {
        x = y;
        return true;
    } else return false;
}

// overload macro
#define CAT( A, B ) A ## B
#define SELECT( NAME, NUM ) CAT( NAME, NUM )

#define GET_COUNT( _1, _2, _3, _4, _5, _6 /* ad nauseam */, COUNT, ... ) COUNT
#define VA_SIZE( ... ) GET_COUNT( __VA_ARGS__, 6, 5, 4, 3, 2, 1 )

#define VA_SELECT( NAME, ... ) SELECT( NAME, VA_SIZE(__VA_ARGS__) )(__VA_ARGS__)

// rep(overload)
#define rep( ... ) VA_SELECT(rep, __VA_ARGS__)
#define rep2(i, n) for (int i = 0; i < int(n); i++)
#define rep3(i, a, b) for (int i = a; i < int(b); i++)
#define rep4(i, a, b, c) for (int i = a; i < int(b); i += c)

// repll(overload)
#define repll( ... ) VA_SELECT(repll, __VA_ARGS__)
#define repll2(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repll3(i, a, b) for (ll i = a; i < (ll)(b); i++)
#define repll4(i, a, b, c) for (ll i = a; i < (ll)(b); i += c)

// rrep(overload)
#define rrep( ... ) VA_SELECT(rrep, __VA_ARGS__)    
#define rrep2(i, n) for (int i = n - 1; i >= 0; i--)
#define rrep3(i, a, b) for (int i = b - 1; i >= a; i--)
#define rrep4(i, a, b, c) for (int i = b - 1; i >= a; i -= c)

// rrepll(overload)
#define rrepll( ... ) VA_SELECT(rrepll, __VA_ARGS__)
#define rrepll2(i, n) for (ll i = (ll)(n) - 1; i >= 0ll; i--)
#define rrepll3(i, a, b) for (ll i = b - 1; i >= (ll)(a); i--)
#define rrepll4(i, a, b, c) for (ll i = b - 1; i >= (ll)(a); i -= c)

// for_earh
#define fore(e, v) for (auto&& e : v)

// vector
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

vector<int> days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool leap(int n) {
    if (n % 400 == 0) return true;
    else if (n % 100 != 0 && n % 4 == 0) return true;
    else return false;
}
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    int dw = 3;
    rep (i, n, 2037) {
        dw = ((dw - (365 + leap(i))) % 7 + 7) % 7;
    }

    if (leap(n)) days[1]++;
    int ans = 0, month = 1;
    fore (u, days) {
        ans++;
        rep (i, 1, u) {
            dw = (dw + 1) % 7;
            ans += dw == 0;
        }
        dw = (dw + 1) % 7;
    }

    cout << ans << endl;
}

詳細信息

Test #1:

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

input:

2023

output:

63

result:

ok 1 number(s): "63"

Test #2:

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

input:

1970

output:

63

result:

ok 1 number(s): "63"

Test #3:

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

input:

1971

output:

61

result:

ok 1 number(s): "61"

Test #4:

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

input:

1972

output:

63

result:

ok 1 number(s): "63"

Test #5:

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

input:

1973

output:

63

result:

ok 1 number(s): "63"

Test #6:

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

input:

1974

output:

62

result:

ok 1 number(s): "62"

Test #7:

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

input:

1975

output:

62

result:

ok 1 number(s): "62"

Test #8:

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

input:

1976

output:

62

result:

ok 1 number(s): "62"

Test #9:

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

input:

1977

output:

63

result:

ok 1 number(s): "63"

Test #10:

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

input:

1978

output:

63

result:

ok 1 number(s): "63"

Test #11:

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

input:

1979

output:

63

result:

ok 1 number(s): "63"

Test #12:

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

input:

1980

output:

62

result:

ok 1 number(s): "62"

Test #13:

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

input:

1981

output:

63

result:

ok 1 number(s): "63"

Test #14:

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

input:

1982

output:

61

result:

ok 1 number(s): "61"

Test #15:

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

input:

1983

output:

63

result:

ok 1 number(s): "63"

Test #16:

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

input:

1984

output:

64

result:

ok 1 number(s): "64"

Test #17:

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

input:

1985

output:

62

result:

ok 1 number(s): "62"

Test #18:

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

input:

1986

output:

62

result:

ok 1 number(s): "62"

Test #19:

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

input:

1987

output:

63

result:

ok 1 number(s): "63"

Test #20:

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

input:

1988

output:

62

result:

ok 1 number(s): "62"

Test #21:

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

input:

1989

output:

63

result:

ok 1 number(s): "63"

Test #22:

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

input:

1990

output:

63

result:

ok 1 number(s): "63"

Test #23:

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

input:

1991

output:

62

result:

ok 1 number(s): "62"

Test #24:

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

input:

1992

output:

63

result:

ok 1 number(s): "63"

Test #25:

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

input:

1993

output:

61

result:

ok 1 number(s): "61"

Test #26:

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

input:

1994

output:

63

result:

ok 1 number(s): "63"

Test #27:

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

input:

1995

output:

63

result:

ok 1 number(s): "63"

Test #28:

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

input:

1996

output:

62

result:

ok 1 number(s): "62"

Test #29:

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

input:

1997

output:

62

result:

ok 1 number(s): "62"

Test #30:

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

input:

1998

output:

63

result:

ok 1 number(s): "63"

Test #31:

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

input:

1999

output:

61

result:

ok 1 number(s): "61"

Test #32:

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

input:

2000

output:

63

result:

ok 1 number(s): "63"

Test #33:

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

input:

2001

output:

63

result:

ok 1 number(s): "63"

Test #34:

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

input:

2002

output:

62

result:

ok 1 number(s): "62"

Test #35:

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

input:

2003

output:

62

result:

ok 1 number(s): "62"

Test #36:

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

input:

2004

output:

62

result:

ok 1 number(s): "62"

Test #37:

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

input:

2005

output:

63

result:

ok 1 number(s): "63"

Test #38:

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

input:

2006

output:

63

result:

ok 1 number(s): "63"

Test #39:

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

input:

2007

output:

63

result:

ok 1 number(s): "63"

Test #40:

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

input:

2008

output:

62

result:

ok 1 number(s): "62"

Test #41:

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

input:

2009

output:

63

result:

ok 1 number(s): "63"

Test #42:

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

input:

2010

output:

61

result:

ok 1 number(s): "61"

Test #43:

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

input:

2011

output:

63

result:

ok 1 number(s): "63"

Test #44:

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

input:

2012

output:

64

result:

ok 1 number(s): "64"

Test #45:

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

input:

2013

output:

62

result:

ok 1 number(s): "62"

Test #46:

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

input:

2014

output:

62

result:

ok 1 number(s): "62"

Test #47:

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

input:

2015

output:

63

result:

ok 1 number(s): "63"

Test #48:

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

input:

2016

output:

62

result:

ok 1 number(s): "62"

Test #49:

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

input:

2017

output:

63

result:

ok 1 number(s): "63"

Test #50:

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

input:

2018

output:

63

result:

ok 1 number(s): "63"

Test #51:

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

input:

2019

output:

62

result:

ok 1 number(s): "62"

Test #52:

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

input:

2020

output:

63

result:

ok 1 number(s): "63"

Test #53:

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

input:

2021

output:

61

result:

ok 1 number(s): "61"

Test #54:

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

input:

2022

output:

63

result:

ok 1 number(s): "63"

Test #55:

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

input:

2024

output:

62

result:

ok 1 number(s): "62"

Test #56:

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

input:

2025

output:

62

result:

ok 1 number(s): "62"

Test #57:

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

input:

2026

output:

63

result:

ok 1 number(s): "63"

Test #58:

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

input:

2027

output:

61

result:

ok 1 number(s): "61"

Test #59:

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

input:

2028

output:

63

result:

ok 1 number(s): "63"

Test #60:

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

input:

2029

output:

63

result:

ok 1 number(s): "63"

Test #61:

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

input:

2030

output:

62

result:

ok 1 number(s): "62"

Test #62:

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

input:

2031

output:

62

result:

ok 1 number(s): "62"

Test #63:

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

input:

2032

output:

62

result:

ok 1 number(s): "62"

Test #64:

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

input:

2033

output:

63

result:

ok 1 number(s): "63"

Test #65:

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

input:

2034

output:

63

result:

ok 1 number(s): "63"

Test #66:

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

input:

2035

output:

63

result:

ok 1 number(s): "63"

Test #67:

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

input:

2036

output:

62

result:

ok 1 number(s): "62"

Test #68:

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

input:

2037

output:

63

result:

ok 1 number(s): "63"

Extra Test:

score: 0
Extra Test Passed