ABC177A --Don't be late I thought it might be, but the coordinates could be negative. Well, I just added abs. While thinking, I didn't do it at ABC177 = I forgot to add it.
N, K, T = map(int, input().split())
if K * T >= abs(N):
print('Yes')
else:
print('No')
Looking at a, b ≤ 10 18 </ sup>, I want to factor it into prime numbers and divide it by a common prime number, but I was wondering what to do if the Eratosthenes sieve cannot be used. Yes, GCD You just have to divide by orz. Dividing means that a × 10 N </ sup>% b = 0, so b divided by the GCD of a and b is 2 N </ strong> If it is sup> × 5 M </ sup>, it is OK.
from math import gcd
a, b = map(int, input().split())
t = gcd(a, b)
b //= t
while b % 2 == 0:
b //= 2
while b % 5 == 0:
b //= 5
if b == 1:
print('No')
else:
print('Yes')
C 1225 I hate I hate Matrix Construction
I self-destructed with a typo (laughs). First, if both S and T have 2, the OR can never be 0 anymore, so it was guaranteed that there were only 1 and 2, and 2 was specified. It is not necessary to put 1 other than that. If there is 2 in either S or T, it is confirmed that the logical sum is 1 for all those who do not have it. If there is 2, there is an appropriate number of 1. If there is no 2 in either S or T, you can put 1 in the number of 1, but you can erase the quotas of S and T one by one for each one. , Only the larger number of 1s should be placed.
N = int(input())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
m = [[0] * N for _ in range(N)]
s1 = S.count(1)
t1 = T.count(1)
s2 = S.count(2)
t2 = T.count(2)
if s2 == 0 and t2 == 0:
print(max(s1, t1))
elif s2 > 0 and t2 > 0:
print(s2 * N + t2 * N - s2 * t2)
elif s2 == 0:
print(t1 + t2 * N)
elif t2 == 0:
print(s1 + s2 * N)
Recommended Posts