I'm studying because I want to be an engineer, but I can't find a job easily. (I know the portfolio is bad)
So I'm playing with python to kill time (use that time to repair the portfolio!)
I've been trying to solve each question from Paiza's D rank since about 3 days ago.
__pleasant! !! !! __
I've been studying the basics, but almost no output has come
I think it's a good place for output for me.
However, I can do competitive programming = I don't think I can work as an engineer, so be careful?
e? Isn't Paiza competitive programming?
Real competitive programming because the question format is similar! So
I knew competitive programming when I was solving Paiza's problem and looking up the syntax.
I will try AtCoder after playing with Paiza that can be done with one screen (It's not a hassle to prepare tools)
From here on, the problems and syntax that I experienced
First from the rudimentary FizzBuzz problem When outputting numbers from 1 to 100, Outputs'Fizz' when it is a multiple of 3,'Buzz' when it is a multiple of 5, and'FizzBuzz' when it is a multiple of 3 and 5. Problem
I think many people who are learning programming have done it First from the general writing style
for i in range(1, 101): if i % 3 == 0 and i % 5 == 0: print('FizzBuzz') elif i % 3 == 0: print('Fizz') elif i % 5 == 0: print('Buzz') else: print(i)
The heart of this problem is first whether the decision is a multiple of 3 and 5. (Please check each one for detailed explanation) To put it simply, "too much divided by 15 is 0" ⊃ "too much divided by 3 (5) is 0" The order of judgment of the remaining multiples of 3 and 5 does not matter, so it is correct to write from either side.
Competitive programming is about writing this more concisely. I was impressed when I first called
for i in range(1, 101): print('Fizz' * (i % 3 == 0) + 'Buzz' * (i % 5 == 0) or i)
How can I write in 2 lines It can be written in just one line, so it can still be improved, but if you draw it so beautifully, it will be impressive enough.
First When two input values M and N (separated by half-width spaces) are given, Outputs'YES'when the evenness of M and N match, and'NO' when not.
If you write it normally, it will be long, so I will omit it This is what I wrote
n, m = map(int, input().split()) print('NO' * (n % 2 == m % 2) or 'YES')
If there are 100 coders, there are 100 ways to write, so for reference only
I tried to introduce some of them, but when I looked back, I didn't write anything amazing, but it was written down, so I will omit it.
That's all for the fun of competition professionals
P.S. C ++ seems to be the fastest in the competition pro, so I started to touch C ++ (Job hunting)