/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 150 点
問題文
九九の表に現れる 81 個の整数のうち、X でないものの総和を求めてください。
縦 9 マス、横 9 マスのグリッドがあります。
グリッドの各マスには整数が書きこまれていて、グリッドの上から i 行目、左から j 列目のマスには i \times j が書きこまれています。
整数 X が与えられます。グリッドに書きこまれた 81 個の整数のうち X でないものの総和を求めてください。値の等しい整数が異なるマスに書きこまれている場合は別々に加算する点に注意してください。
制約
- X は 1 以上 81 以下の整数
入力
入力は以下の形式で標準入力から与えられる。
X
出力
グリッドに書きこまれた 81 個の整数のうち X でないものの総和を出力せよ。
入力例 1
1
出力例 1
2024
グリッドに 1 が書きこまれたマスは上から 1 行目、左から 1 列目のマスのみです。1 でない整数を全て足し合わせると総和は 2024 になります。
入力例 2
11
出力例 2
2025
グリッドに 11 が書きこまれたマスは存在しません。よって 81 個の整数全てを足し合わせた総和である 2025 が答えとなります。
入力例 3
24
出力例 3
1929
Score : 150 points
Problem Statement
Among the 81 integers that appear in the 9-by-9 multiplication table, find the sum of those that are not X.
There is a grid of size 9 by 9.
Each cell of the grid contains an integer: the cell at the i-th row from the top and the j-th column from the left contains i \times j.
You are given an integer X. Among the 81 integers written in this grid, find the sum of those that are not X. If the same value appears in multiple cells, add it for each cell.
Constraints
- X is an integer between 1 and 81, inclusive.
Input
The input is given from Standard Input in the following format:
X
Output
Print the sum of the integers that are not X among the 81 integers written in the grid.
Sample Input 1
1
Sample Output 1
2024
The only cell with 1 in the grid is the cell at the 1st row from the top and 1st column from the left. Summing all integers that are not 1 yields 2024.
Sample Input 2
11
Sample Output 2
2025
There is no cell containing 11 in the grid. Thus, the answer is 2025, the sum of all 81 integers.
Sample Input 3
24
Sample Output 3
1929