LoginSignup
2
2

More than 5 years have passed since last update.

Project Euler 1をワンライナーで書いてみた。

Last updated at Posted at 2015-02-25

Project Euler problem 1をワンライナーで書いてみた。

回答案1
print sum([i for i in range(1,1000) if i%3*i%5==0])

回答案2
print sum(set(range(3,1000,3)+range(5,1000,5)))

とりあえず思いついたのは以上。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2