A - Century Editorial by en_translator

The year \(N\) is in the \(\lfloor \frac{N+99}{100} \rfloor\)-th century (where \(\lfloor x \rfloor\) denotes \(x\) rounded down), so output this.

Sample code in Python:

import math

n = int(input())

Alternatively, we can see the following fact:
“The year \(N\) is in the \(X\) century if and only if one can pay \(N\) cents with (at least) \(X\) one-dollar coins.”
Therefore, it is possible to implement by splitting into cases depending on whether \(N\) is a multiple of \(100\) or not.

Sample code in Java:

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n=scanner.nextInt();

last update: