Beginner ABC155 (Python)

Click here for the contest page

https://atcoder.jp/contests/abc155 A

a, b, c  = input().split()
ans = 'No'
if (a==b and a!=c) or (a==c and a!=b) or (b==c and a!=b): ans = 'Yes'
print(ans)

Since there were only three things to compare, we made a conditional branch by listing all the cases where "two are together and one is different". I think it took longer than usual A problem.
Submission https://atcoder.jp/contests/abc155/submissions/10135101

Postscript

Added a comment from @shiracamus. Consider the set () as a list of inputs. Outputs Yes if the size is 2, and No otherwise.

if len(set(input().split())) == 2: print('Yes')
else: print('No')

Submission https://atcoder.jp/contests/abc155/submissions/10242708 B

n = int(input())
a = list(map(int, input().split()))
ans = 'APPROVED'
for i in a:
    if i % 2 != 0: continue
    if (i % 3==0) or (i % 5==0): continue
    ans = 'DENIED'
    break
print(ans)

Look at A_1, ..., A_N in order, and if it is odd or evendivisible by 3 or 5, look at the next element. If the two conditions are not met, the final output is set toDENIED` and the for statement is exited.
Submission https://atcoder.jp/contests/abc155/submissions/10141261

C

n = int(input())
s = [input() for _ in range(n)]
d = {}
for w in s:
    if w not in d:
        d[w] = 0
    d[w] += 1
d2 = sorted(d.items(), key=lambda x:x[1], reverse=True)
maxcnts = [w[0] for w in d2 if w[1] == d2[0][1]]
maxcnts.sort()
for ans in maxcnts:
    print(ans)

Make a dictionary of words. A dictionary in the form of {word: number of occurrences}. After that, it sorts by the number of occurrences, which is the value of the dictionary, and creates a list maxcnts of only the maximum number of words. Since sort () and sorted () of python can also sort the characters, the maxcnts is sorted in alphabetical order and output one by one.
Submission https://atcoder.jp/contests/abc155/submissions/10146425

D, E and F

I would like to add it if I can AC. D is struggling to solve and understand.

Recommended Posts

Beginner ABC156 (Python)
Beginner ABC155 (Python)
Beginner ABC157 (Python)
python beginner memo (9.2-10)
AtCoder ABC 174 Python
python beginner memo (9.1)
Python beginner notes
[Beginner] Python array
AtCoder ABC187 Python
AtCoder ABC188 Python
[Beginner] Python functions
PyQ ~ Python Beginner ~
Python beginner memo (2)
AtCoder ABC 175 Python
Python beginner Zundokokiyoshi
Python beginner Atcoder memo @ KEYENCE 2020, ABC problem
Solve ABC169 in Python
ABC147 C --HonestOrUnkind2 [Python]
ABC168
Solve AtCoder ABC166 with python
ABC164
ABC163 C problem with python3
python super beginner tries scraping
AtCoder ABC 178 Python (A ~ E)
Python
Atcoder ABC164 A-C in Python
Solve ABC176 E in Python
ABC memorandum [ABC163 C --managementr] (Python)
Python beginner launches Discord Bot
AtCoder ABC 176 Python (A ~ E)
Atcoder ABC167 A-D in Python
Solve ABC175 D in Python
Atcoder ABC165 A-D in Python
Atcoder ABC166 A-E in Python
ABC175
ABC170
AtCoder ABC 182 Python (A ~ D)
Web scraping beginner with python
ABC188 C problem with python3
[Python beginner] Update pip itself
Solve AtCoder ABC 186 with Python
Atcoder Beginner Contest 152 Kiroku (python)
ABC182
ABC153
ABC187 C problem with python
Atcoder ABC169 A-E in Python
AtCoder ABC177 A-D in python
ABC memorandum [ABC159 C --Maximum Volume] (Python)
Solve ABC163 A ~ C with Python
ABC127 A, B, C Explanation (python)
Solve ABC166 A ~ D with Python
ABC166 in Python A ~ C problem
Solve Atcoder ABC169 A-D in Python
Let's play with Excel with Python [Beginner]
[Python beginner] Divide one list (5 lines).
Solve ABC168 A ~ C with Python
ABC memorandum [ABC161 C --Replacing Integer] (Python)
Solve ABC036 A ~ C in Python
[Beginner] Extract character strings with Python
ABC memorandum [ABC158 C --Tax Increase] (Python)
Python beginner tried 100 language processing knock 2015 (05 ~ 09)