[PYTHON] yukicoder contest 265 Participation record

yukicoder contest 265 Participation record

A 1223 I hate Golf

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')

B 1224 I hate Sqrt Inequality

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

yukicoder contest 265 Participation record
yukicoder contest 266 Participation record
yukicoder contest 263 Participation record
yukicoder contest 243 Participation record
yukicoder contest 273 Participation record
yukicoder contest 252 Participation record
yukicoder contest 259 Participation record
yukicoder contest 249 Participation record
yukicoder contest 271 Participation record
yukicoder contest 251 Participation record
yukicoder contest 242 Participation record
yukicoder contest 241 Participation record
yukicoder contest 277 Participation record
yukicoder contest 257 Participation record
yukicoder contest 254 Participation record
yukicoder contest 246 Participation record
yukicoder contest 275 Participation record
yukicoder contest 274 Participation record
yukicoder contest 247 Participation record
yukicoder contest 261 Participation record
yukicoder contest 278 Participation record
yukicoder contest 248 Participation record
yukicoder contest 270 (mathematics contest) Participation record
yukicoder contest 272 (Weird math contest) Participation record
yukicoder contest 256 entry record
yukicoder contest 267 entry record
yukicoder contest 264 entry record
yukicoder contest 245 entry record
yukicoder contest 250 entry record
yukicoder contest 262 entry record
yukicoder contest 259 Review
yukicoder contest 264 Review
yukicoder contest 261 Review
yukicoder contest 267 Review
yukicoder contest 266 Review
yukicoder contest 263 Review
yukicoder contest 268 Review
AtCoder Beginner Contest 181 Participation Report
AtCoder Beginner Contest 161 Participation Report
AtCoder Beginner Contest 151 Participation Report
AtCoder Beginner Contest 176 Participation Report
AtCoder Beginner Contest 154 Participation Report
AtCoder Beginner Contest # 003 Participation Note
AtCoder Grand Contest 041 Participation Report
AtCoder Beginner Contest 166 Participation Report
AtCoder Grand Contest 040 Participation Report
AtCoder Beginner Contest 153 Participation Report
AtCoder Beginner Contest 145 Participation Report
AtCoder Beginner Contest 184 Participation Report
AtCoder Beginner Contest 165 Participation Report
AtCoder Beginner Contest 160 Participation Report
AtCoder Beginner Contest 169 Participation Report
AtCoder Beginner Contest 178 Participation Report
AtCoder Beginner Contest 163 Participation Report
AtCoder Beginner Contest 159 Participation Report
AtCoder Beginner Contest 164 Participation Report
AtCoder Regular Contest 105 Participation Report
AtCoder Beginner Contest 168 Participation Report
AtCoder Beginner Contest 150 Participation Report
AtCoder Beginner Contest 158 Participation Report
AtCoder Beginner Contest 180 Participation Report