首页 > 试题广场 >

守形数

[编程题]守形数
  • 热度指数:14289 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 64M,其他语言128M
  • 算法知识视频讲解
守形数是这样一种整数,它的平方的低位部分等于它本身。 比如25的平方是625,低位部分是25,因此25是一个守形数。 编一个程序,判断N是否为守形数。

输入描述:
输入包括1个整数N,2<=N<100。


输出描述:
可能有多组测试数据,对于每组数据,
输出"Yes!”表示N是守形数。
输出"No!”表示N不是守形数。
示例1

输入

25
4

输出

Yes!
No!
头像 在考古的小鱼干很有气魄
发表于 2023-03-07 10:01:06
#include <bits/stdc++.h> #define MAX 100 using namespace std; int main(){ int n,data[MAX]; while(cin>>n){ string s1 = to_string(n); 展开全文
头像 鱼儿恋上水
发表于 2020-03-29 20:40:40
题目已经说明了2<=N<100故可分为以下两种情况分析:①2<=N<=10:当N=5或N=6时,满足守形数的条件,返回真,其余一位数不满足,返回假②10<=N<100:当N>=10时,因为都是两位数,故其平方对100取模即可提取出最低的两位数,与i对比若相同 展开全文
头像 joust
发表于 2023-02-14 23:00:00
#include <iostream> #include<sstream> #include<string> using namespace std; int main(int argc, char** argv) { int a; int b;int c; 展开全文
头像 MountainsHao
发表于 2024-03-14 15:24:27
#include <stdio.h> #include <stdbool.h> bool isShouxing(int n) { int temp1 = n, temp2 = n * n; while (temp1 > 0) { if (temp1 % 1 展开全文
头像 奔放的芭乐在做ppt
发表于 2023-04-18 22:22:59
#include<cstdio> #include<iostream> using namespace std; int DIWEI(int n) { int part; int result=n*n; if(n<=9) { part=result%10; 展开全文
头像 壹玄
发表于 2024-03-21 20:32:54
#include <cstdio> using namespace std; int main(){ int n,npow; while (scanf("%d",&n)!=EOF){ npow=n*n; if(n 展开全文
头像 牛客674554120号
发表于 2024-03-22 21:48:39
#include<bits/stdc++.h> using namespace std; //11 121 int main() { int N; while (cin >> N) { int a = N * N, b = N; 展开全文
头像 Jolly_z
发表于 2023-09-04 12:09:24
#include <cstdio> #include <iostream> #include <cmath> #include <queue> using namespace std; int main() { int n; whil 展开全文
头像 小徐小徐啊啊
发表于 2024-03-11 19:45:58
#include <stdio.h> int main() { int n,m; while(scanf("%d",&n)!=EOF) { m=n*n; while(n>0) { if(n%10==m%10 展开全文
头像 komeijisatorii
发表于 2023-02-18 16:45:51
#include <iostream> using namespace std; int main() { int n; while(cin >> n){ int sq = n * n; int flag = 0; 展开全文

问题信息

难度:
164条回答 13835浏览

热门推荐

通过挑战的用户

查看代码