Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
from collections import deque energy = deque(int(x) for x in input().split()) materials = [int(x) for x in input().split()] toys = 0 counter = 0 while energy or materials: current_energy = energy.popleft() current_materials = materials.pop() if current_energy >= current_materials: counter += 1 if counter % 3 == 0: if current_energy >= current_materials * 2 toys += 2 current_energy = current_energy + 1 current_energy -= current_materials energy.append(current_energy) elif counter % 5 == 0: pass else: toys += 1 current_energy = current_energy + 1 current_energy -= current_materials energy.append(current_energy) print(counter) else: pass
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)