yukicoder contest 247 Participation record

yukicoder contest 247 Participation record

A 1046 Fruits Rush

If there are positively fresh fruits, only the positively fresh fruits are adopted in order from the largest (all if there are no K). Even if there are only 0 or less fruits, b, the most 0 Adopt only one close one.

N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
print(A[0] + sum([a for a in A[1:] if a > 0][:K - 1]))

B 1047 Zero (Novice)

I don't know, so I wrote a code that just turns the loop a lot and checks if it becomes 0, and then AC (terrible). Since A and B are large, I do TLE after 10 5 </ sup> turns. ..

A, B = map(int, input().split())

N = 0
for i in range(1, 10000):
    N = A * N + B
    if N == 0:
        print(i)
        exit()
print(-1)

C 1048 Zero (Advanced)

After K operations, N becomes L * K <= N <= R * K. There is an operation sequence such that N = 0 if the multiple of the maximum M less than or equal to R * K is A or more. This means. ABC165A --We Love Golf when A is L * K and B is R * K with * O * (1) It's a problem to solve (laughs).

L, R, M, K = map(int, input().split())

if R * K // M * M >= L * K:
    print('Yes')
else:
    print('No')

Recommended Posts

yukicoder contest 265 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 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 Grand Contest 041 Participation Report
AtCoder Grand Contest 040 Participation Report
AtCoder Beginner Contest 153 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 Beginner Contest 168 Participation Report
AtCoder Beginner Contest 150 Participation Report
AtCoder Beginner Contest 158 Participation Report
AtCoder Beginner Contest 180 Participation Report
AtCoder Beginner Contest 156 Participation Report
AtCoder Beginner Contest 167 Participation Report
AtCoder Beginner Contest 179 Participation Report
AtCoder Beginner Contest 182 Participation Report
AtCoder Beginner Contest 146 Participation Report
AtCoder Beginner Contest 152 Participation Report
AtCoder Beginner Contest 155 Participation Report
AtCoder Beginner Contest 174 Participation Report