QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#169329#7176. I Flipped The Calendar...ucup-team859#AC ✓106ms58364kbJava11759b2023-09-09 13:20:252023-09-09 13:20:28

Judging History

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

  • [2023-09-09 13:20:28]
  • 评测
  • 测评结果:AC
  • 用时:106ms
  • 内存:58364kb
  • [2023-09-09 13:20:25]
  • 提交

answer



import java.io.IOException;
import java.time.LocalDate;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);

        int year = scanner.nextInt();
//        int year = 2023;
        LocalDate d1 = LocalDate.of(year, 1, 1);
        LocalDate d2 = LocalDate.of(year, 12, 31);

        int weekDay = d1.getDayOfWeek().getValue() - 1;
        int answer = 1;

        while (!d1.equals(d2)) {
            weekDay = (weekDay + 1) % 7;
            d1 = d1.plusDays(1);
            if (weekDay == 0 || d1.getDayOfMonth() == 1) {
                answer++;
            }
        }

        System.out.println(answer);
    }

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 73ms
memory: 56264kb

input:

2023

output:

63

result:

ok 1 number(s): "63"

Test #2:

score: 0
Accepted
time: 83ms
memory: 57544kb

input:

1970

output:

63

result:

ok 1 number(s): "63"

Test #3:

score: 0
Accepted
time: 89ms
memory: 55436kb

input:

1971

output:

61

result:

ok 1 number(s): "61"

Test #4:

score: 0
Accepted
time: 93ms
memory: 54160kb

input:

1972

output:

63

result:

ok 1 number(s): "63"

Test #5:

score: 0
Accepted
time: 83ms
memory: 55396kb

input:

1973

output:

63

result:

ok 1 number(s): "63"

Test #6:

score: 0
Accepted
time: 92ms
memory: 55132kb

input:

1974

output:

62

result:

ok 1 number(s): "62"

Test #7:

score: 0
Accepted
time: 102ms
memory: 57692kb

input:

1975

output:

62

result:

ok 1 number(s): "62"

Test #8:

score: 0
Accepted
time: 77ms
memory: 55720kb

input:

1976

output:

62

result:

ok 1 number(s): "62"

Test #9:

score: 0
Accepted
time: 91ms
memory: 54628kb

input:

1977

output:

63

result:

ok 1 number(s): "63"

Test #10:

score: 0
Accepted
time: 84ms
memory: 55260kb

input:

1978

output:

63

result:

ok 1 number(s): "63"

Test #11:

score: 0
Accepted
time: 78ms
memory: 55596kb

input:

1979

output:

63

result:

ok 1 number(s): "63"

Test #12:

score: 0
Accepted
time: 62ms
memory: 55636kb

input:

1980

output:

62

result:

ok 1 number(s): "62"

Test #13:

score: 0
Accepted
time: 81ms
memory: 55372kb

input:

1981

output:

63

result:

ok 1 number(s): "63"

Test #14:

score: 0
Accepted
time: 83ms
memory: 51432kb

input:

1982

output:

61

result:

ok 1 number(s): "61"

Test #15:

score: 0
Accepted
time: 73ms
memory: 54232kb

input:

1983

output:

63

result:

ok 1 number(s): "63"

Test #16:

score: 0
Accepted
time: 94ms
memory: 55760kb

input:

1984

output:

64

result:

ok 1 number(s): "64"

Test #17:

score: 0
Accepted
time: 89ms
memory: 55756kb

input:

1985

output:

62

result:

ok 1 number(s): "62"

Test #18:

score: 0
Accepted
time: 73ms
memory: 56036kb

input:

1986

output:

62

result:

ok 1 number(s): "62"

Test #19:

score: 0
Accepted
time: 85ms
memory: 53208kb

input:

1987

output:

63

result:

ok 1 number(s): "63"

Test #20:

score: 0
Accepted
time: 95ms
memory: 55828kb

input:

1988

output:

62

result:

ok 1 number(s): "62"

Test #21:

score: 0
Accepted
time: 78ms
memory: 54744kb

input:

1989

output:

63

result:

ok 1 number(s): "63"

Test #22:

score: 0
Accepted
time: 78ms
memory: 53192kb

input:

1990

output:

63

result:

ok 1 number(s): "63"

Test #23:

score: 0
Accepted
time: 94ms
memory: 55460kb

input:

1991

output:

62

result:

ok 1 number(s): "62"

Test #24:

score: 0
Accepted
time: 103ms
memory: 54016kb

input:

1992

output:

63

result:

ok 1 number(s): "63"

Test #25:

score: 0
Accepted
time: 87ms
memory: 55572kb

input:

1993

output:

61

result:

ok 1 number(s): "61"

Test #26:

score: 0
Accepted
time: 96ms
memory: 52808kb

input:

1994

output:

63

result:

ok 1 number(s): "63"

Test #27:

score: 0
Accepted
time: 98ms
memory: 56000kb

input:

1995

output:

63

result:

ok 1 number(s): "63"

Test #28:

score: 0
Accepted
time: 94ms
memory: 55280kb

input:

1996

output:

62

result:

ok 1 number(s): "62"

Test #29:

score: 0
Accepted
time: 75ms
memory: 56032kb

input:

1997

output:

62

result:

ok 1 number(s): "62"

Test #30:

score: 0
Accepted
time: 83ms
memory: 55088kb

input:

1998

output:

63

result:

ok 1 number(s): "63"

Test #31:

score: 0
Accepted
time: 78ms
memory: 55936kb

input:

1999

output:

61

result:

ok 1 number(s): "61"

Test #32:

score: 0
Accepted
time: 87ms
memory: 54412kb

input:

2000

output:

63

result:

ok 1 number(s): "63"

Test #33:

score: 0
Accepted
time: 78ms
memory: 55476kb

input:

2001

output:

63

result:

ok 1 number(s): "63"

Test #34:

score: 0
Accepted
time: 71ms
memory: 55248kb

input:

2002

output:

62

result:

ok 1 number(s): "62"

Test #35:

score: 0
Accepted
time: 72ms
memory: 56896kb

input:

2003

output:

62

result:

ok 1 number(s): "62"

Test #36:

score: 0
Accepted
time: 77ms
memory: 56152kb

input:

2004

output:

62

result:

ok 1 number(s): "62"

Test #37:

score: 0
Accepted
time: 103ms
memory: 54312kb

input:

2005

output:

63

result:

ok 1 number(s): "63"

Test #38:

score: 0
Accepted
time: 103ms
memory: 55860kb

input:

2006

output:

63

result:

ok 1 number(s): "63"

Test #39:

score: 0
Accepted
time: 90ms
memory: 54404kb

input:

2007

output:

63

result:

ok 1 number(s): "63"

Test #40:

score: 0
Accepted
time: 106ms
memory: 55404kb

input:

2008

output:

62

result:

ok 1 number(s): "62"

Test #41:

score: 0
Accepted
time: 90ms
memory: 54808kb

input:

2009

output:

63

result:

ok 1 number(s): "63"

Test #42:

score: 0
Accepted
time: 88ms
memory: 55156kb

input:

2010

output:

61

result:

ok 1 number(s): "61"

Test #43:

score: 0
Accepted
time: 78ms
memory: 56184kb

input:

2011

output:

63

result:

ok 1 number(s): "63"

Test #44:

score: 0
Accepted
time: 85ms
memory: 53700kb

input:

2012

output:

64

result:

ok 1 number(s): "64"

Test #45:

score: 0
Accepted
time: 78ms
memory: 57332kb

input:

2013

output:

62

result:

ok 1 number(s): "62"

Test #46:

score: 0
Accepted
time: 47ms
memory: 54408kb

input:

2014

output:

62

result:

ok 1 number(s): "62"

Test #47:

score: 0
Accepted
time: 79ms
memory: 54132kb

input:

2015

output:

63

result:

ok 1 number(s): "63"

Test #48:

score: 0
Accepted
time: 88ms
memory: 55184kb

input:

2016

output:

62

result:

ok 1 number(s): "62"

Test #49:

score: 0
Accepted
time: 58ms
memory: 55744kb

input:

2017

output:

63

result:

ok 1 number(s): "63"

Test #50:

score: 0
Accepted
time: 81ms
memory: 55192kb

input:

2018

output:

63

result:

ok 1 number(s): "63"

Test #51:

score: 0
Accepted
time: 72ms
memory: 55228kb

input:

2019

output:

62

result:

ok 1 number(s): "62"

Test #52:

score: 0
Accepted
time: 57ms
memory: 55356kb

input:

2020

output:

63

result:

ok 1 number(s): "63"

Test #53:

score: 0
Accepted
time: 81ms
memory: 54040kb

input:

2021

output:

61

result:

ok 1 number(s): "61"

Test #54:

score: 0
Accepted
time: 67ms
memory: 57472kb

input:

2022

output:

63

result:

ok 1 number(s): "63"

Test #55:

score: 0
Accepted
time: 83ms
memory: 57332kb

input:

2024

output:

62

result:

ok 1 number(s): "62"

Test #56:

score: 0
Accepted
time: 92ms
memory: 55708kb

input:

2025

output:

62

result:

ok 1 number(s): "62"

Test #57:

score: 0
Accepted
time: 82ms
memory: 55496kb

input:

2026

output:

63

result:

ok 1 number(s): "63"

Test #58:

score: 0
Accepted
time: 69ms
memory: 55692kb

input:

2027

output:

61

result:

ok 1 number(s): "61"

Test #59:

score: 0
Accepted
time: 82ms
memory: 55740kb

input:

2028

output:

63

result:

ok 1 number(s): "63"

Test #60:

score: 0
Accepted
time: 92ms
memory: 57200kb

input:

2029

output:

63

result:

ok 1 number(s): "63"

Test #61:

score: 0
Accepted
time: 80ms
memory: 58072kb

input:

2030

output:

62

result:

ok 1 number(s): "62"

Test #62:

score: 0
Accepted
time: 73ms
memory: 55880kb

input:

2031

output:

62

result:

ok 1 number(s): "62"

Test #63:

score: 0
Accepted
time: 81ms
memory: 55812kb

input:

2032

output:

62

result:

ok 1 number(s): "62"

Test #64:

score: 0
Accepted
time: 81ms
memory: 55464kb

input:

2033

output:

63

result:

ok 1 number(s): "63"

Test #65:

score: 0
Accepted
time: 80ms
memory: 58364kb

input:

2034

output:

63

result:

ok 1 number(s): "63"

Test #66:

score: 0
Accepted
time: 83ms
memory: 54176kb

input:

2035

output:

63

result:

ok 1 number(s): "63"

Test #67:

score: 0
Accepted
time: 97ms
memory: 53636kb

input:

2036

output:

62

result:

ok 1 number(s): "62"

Test #68:

score: 0
Accepted
time: 76ms
memory: 57172kb

input:

2037

output:

63

result:

ok 1 number(s): "63"

Extra Test:

score: 0
Extra Test Passed