Python Nozioni di baseFacile

Numero automorfo

Guida dettagliata e implementazione Python per il problema del "numero automorfico".

Dichiarazione del problema

Facile

Scrivi una funzione is_automorphic(n) che accetta un intero non negativo n e restituisce True se n è un numero automorfico, o False altrimenti. Un numero automorfo è un numero il cui quadrato termina con il numero stesso. Ad esempio, 25 è automorfo perché 25^2 = 625, che termina con 25.

Vincoli
  • 0 <= n <= 10^6

Esempi

Example 1
Input
n = 25
Output
True
Explanation

25^2 = 625. The last two digits of 625 are 25, which matches n.

Example 2
Input
n = 76
Output
True
Explanation

76^2 = 5776. The last two digits of 5776 are 76, which matches n.

Example 3
Input
n = 13
Output
False
Explanation

13^2 = 169. The last two digits of 169 are 69, which does not match 13.

Need a Hint?
Prendi in considerazione l'utilizzo di strutture dati specifiche di Basics come set o heap.
Edge Cases to Watch
  • Strutture di input vuote
  • Ingressi a elemento singolo
  • Grandi limiti numerici

Pronto a risolvere?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Apri nell'editor
Found this breakdown helpful?

PyRun is built and maintained by an independent solo developer. If this helped your interview prep, consider buying a coffee!

Buy me a coffee

Risorse Python consigliate

Espandi le tue conoscenze con tutorial interattivi, foglietti illustrativi e confronti di codici correlati.