#C14469. Sum of Squares Computation

    ID: 44121 Type: Default 1000ms 256MiB

Sum of Squares Computation

Sum of Squares Computation

Given an input value n, compute the sum of the squares of all integers from 1 to n inclusive, i.e., \(S = 1^2 + 2^2 + \cdots + n^2\). If the input is not an integer, output the error message "Input should be an integer.". If the integer is less than 1, output "Input should be a positive integer.".

Please note:

  • The input will be provided via standard input.
  • The output should be printed to standard output.

inputFormat

The input consists of a single line containing a value which is expected to be an integer.

outputFormat

If the input is a valid positive integer n, output the sum of squares \(1^2 + 2^2 + \cdots + n^2\). Otherwise, print the corresponding error message exactly as specified:

  • If the input is not an integer: "Input should be an integer."
  • If the input is an integer but less than 1: "Input should be a positive integer."
## sample
5
55