平方具有对称性质的数(256以内)
2018-01-06 21:28
477 查看
#include<iostream> #include<string> using namespace std; int main(){ int i,j,temp,count,flag,r,len; char numstr[20]={0}; for(i=0;i<256;i++) { temp=i*i; count=0; while(temp!=0) { r=temp%10; numstr[count]=r+'0'; count++; temp/=10; } len=strlen(numstr); flag=1; for(j=0;j<len;j++) { if(numstr[j]!=numstr[len-j-1]) { flag=0; break; } } if(flag==1) { cout<<"i"<<","<<i*i<<endl; } } return 0; }
相关文章推荐
- 打印所有不超过n(n<256)的,其平方具有对称性质的数。
- 打印所有不超过n(n<256),其平方具有对称性质的数,如11*11=121
- 打印所有不超过256,其平方具有对称性质的数(也称回文数,例如22的平方是484, 484是回文数。则打印22 和484)。
- 打印所有不超过n(n<256)的,其平方具有对称性质的数,如11*11=121.
- 找出所有n的平方具有对称性质(也称回文数)的数
- (百例编程)29.求具有abcd=(ab+cd)平方的性质数
- 打印所有不超过n(n<256)的其平方具有对称性的数(也称回文数)
- 用栈和队列判断输入字符串是否是回文(回文具有两边对称的性质)
- 求具有abcd=(ab+cd)的平方的性质的数
- OJ 2410: 求n以内奇数的平方和【简单循环】
- 题目1074:对称平方数
- oj刷题 Problem C: 五位以内的对称素数
- 题目1072:有多少不同的面值组合? 题目1074:对称平方数 题目1075:斐波那契数列 题目1076:N的阶乘
- 九度OJ 题目1074:对称平方数
- 求n以内(不包括n)同时能被3和7整除的所有自然数之和的平方根s,并作为函数值返回,最后结果s输出到文件out.dat中。例如若n为1000时,函数值应为:s=153.909064。
- (百例编程)80.奇数平方的一个有趣的性质
- 1026-五位以内的对称素数
- 北京理工大学2002年上机题之对称平方数
- 利用字符串指针编写以程序求所有不超过200的N值,N的平方是具有对称性的回文数
- 奇数平方的一个有趣性质