Lanqiao Cup official website fill-in-the-blank questions (end in square)

Question description

This question is a fill-in-the-blank question. You only need to calculate the result and use the output statement in the code to output the filled-in result.

A number that can be expressed as the square of an integer is called a "square number"

Although you cannot immediately tell that a number is a square, you can often conclude that a number is not a square. Because the last digit of a square number can only be one of the six numbers [0,1,4,5,6,9]. Therefore, 4325435332 must not be a square number.

If you are given a number of 2 or more digits, can you tell based on the last two digits that it is not a square number?

Please calculate, how many possibilities are there for the last two digits of a square number with more than 2 digits?

operating restrictions

  • Maximum running time: 1s
  • Maximum running memory: 128M
import java.util.*;

public class Main {
    public static void main(String[] args) {
        HashSet<Integer> h=new HashSet<Integer>();
        for(int i=10;i<1000;i++){
          h.add(i*i%100);
        }
    System.out.println(h.size());
    }
}

Guess you like

Origin blog.csdn.net/s44Sc21/article/details/132795925