[Python] Round up with just the operator

Truncate

#Truncate 3 by 2
[in]  3 // 2
[out] 1

Round up

#Round up 3 to 2
[in]  -(-3//2)
[out] 2

** Impression ** There are times when you want to make the calculation speed as fast as possible in a competition professional. If you call the library one by one, it will become TLE, but if it is only an operator, it is fast. Rounding up is a little confusing, but (-3 // 2) rounds down -3 by 2, so it becomes -2.

Recommended Posts

[Python] Round up with just the operator
Call the API with python3.
String format with Python% operator
Get the weather with Python requests
Get the weather with Python requests 2
Find the Levenshtein Distance with python
Hit the Etherpad-lite API with Python
Install the Python plugin with Netbeans 8.0.2
I liked the tweet with python. ..
Roughly speed up Python with numba
Master the type with Python [Python 3.9 compatible]
Easy way to round off to the nearest whole number with python3
Make the Python console covered with UNKO
Behind the flyer: Using Docker with Python
Check the existence of the file with python
[Python] Get the variable name with str
Display Python 3 in the browser with MAMP
Search the maze with the python A * algorithm
Let's read the RINEX file with Python ①
Working with OpenStack using the Python SDK
Download files on the web with Python
Learn the design pattern "Singleton" with Python
[Python] Automatically operate the browser with Selenium
Learn the design pattern "Facade" with Python
The road to compiling to Python 3 with Thrift
I tried "smoothing" the image with Python + OpenCV
FizzBuzz with Python3
Scraping with Python
Mathematics memorandum to keep up with the field # 4
[Python] Get the files in a folder with Python
Load the network modeled with Rhinoceros in Python ③
Prepare the execution environment of Python3 with Docker
Statistics with python
2016 The University of Tokyo Mathematics Solved with Python
I tried "differentiating" the image with Python + OpenCV
Just add the python array to the json data
Scraping with Python
Find the mood value with python (Rike Koi)
[Note] Export the html of the site with python.
The easiest way to synthesize speech with python
Try to solve the man-machine chart with Python
[Automation] Extract the table in PDF with Python
Python log is not output with docker-compose up
Calculate the total number of combinations with python
Specify the Python executable to use with virtualenv
Use logger with Python for the time being
Twilio with Python
Integrate with Python
Check the date of the flag duty with Python
Play with 2016-Python
Say hello to the world with Python with IntelliJ
AES256 with python
Tested with Python
python starts with ()
I tried "binarizing" the image with Python + OpenCV
The easiest way to use OpenCV with python
Specifying the module loading destination with GAE python
Mathematics memorandum to keep up with the field # 1
Manage AWS nicely with the Python library Boto
with syntax (Python)
Load the network modeled with Rhinoceros in Python ②