Skip to content
Navigation Menu
Toggle navigation
Sign in
Product
GitHub Copilot
Write better code with AI
GitHub Advanced Security
Find and fix vulnerabilities
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Discussions
Collaborate outside of code
Code Search
Find more, search less
Explore
Why GitHub
All features
Documentation
GitHub Skills
Blog
Solutions
By company size
Enterprises
Small and medium teams
Startups
Nonprofits
By use case
DevSecOps
DevOps
CI/CD
View all use cases
By industry
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
Topics
AI
DevOps
Security
Software Development
View all
Explore
Learning Pathways
Events & Webinars
Ebooks & Whitepapers
Customer Stories
Partners
Executive Insights
Open Source
GitHub Sponsors
Fund open source developers
The ReadME Project
GitHub community articles
Repositories
Topics
Trending
Collections
Enterprise
Enterprise platform
AI-powered developer platform
Available add-ons
GitHub Advanced Security
Enterprise-grade security features
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search or jump to...
Search code, repositories, users, issues, pull requests...
Search syntax tips
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Sign in
Sign up
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
feiskyer
/
python-tutorials
Public
Notifications
You must be signed in to change notification settings
Fork
27
Star
38
Code
Issues
0
Pull requests
1
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
master
Breadcrumbs
python-tutorials
/
python-challenge
/
uzi.py
Copy path
Blame
Blame
Latest commit
History
History
26 lines (21 loc) · 1.1 KB
master
Breadcrumbs
python-tutorials
/
python-challenge
/
uzi.py
Top
File metadata and controls
Code
Blame
26 lines (21 loc) · 1.1 KB
Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python
# coding: utf-8
# 题目日历中的年份中间被涂掉了,可以猜测年份区间为[1006, 2006];
# 其次,进一步观察日历发现,当年的1月1日正好是周四,而且日历右下角显示的2月份有29日,因此当年应该是闰年;
# 由此计算得到几个候选的年份: [1176, 1356, 1576, 1756, 1976] 。
# 然后注意到,题目的 title 是 'whom?' 。意味着这个题目的目的应该是找一个人。
# 在题目页面源代码上有两行提示信息:
#'he ain't the youngest, he is the second' - 据此选择年份 '1756' ;
#'todo: buy flowers for tomorrow' - 按照日历显示,当天应该是 1756年1月26日,
# Google一下第二天(即1756年1月27日),发现是Mozart的生日!答案出来了!
import
datetime
#闰年判定
def
is_leap_year
(
year
):
if
year
%
100
==
0
:
return
year
%
400
==
0
return
year
%
4
==
0
candidated_years
=
[]
for
y
in
xrange
(
1006
,
2007
,
10
):
if
datetime
.
date
(
y
,
1
,
1
).
weekday
()
==
3
and
is_leap_year
(
y
):
candidated_years
.
append
(
y
)
print
candidated_years
You can’t perform that action at this time.