当前位置:网站首页>Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu
Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu
2022-07-03 19:20:00 【Shares_ four】
//4 Bit Caprica number
int main()
{
int a, b, c, x, y;
printf(" 4 The number of bit Caprica is :");
c = (int)sqrt(1000);
for (b = c + 1; b <= 99; b++) // enumeration 2 digit b
{
a = b * b;
x = a / 100; // a It is divided into two parts 2 Male
y = a % 100; // Segment and condition inspection
if( y >= 10 && b == (x + y))
printf("%d, ", a);
}
return 0;
}
result :
// Search the even digit number of Caprica
int main()
{
double a, b, m, w, x, y;
int k, n; long c, d;
printf(" Please enter an even number n(n≤14) :");
scanf("%d", &n);
if (n % 2 > 0)
{
printf(" Please enter an even number !\n");
return 0;
}
printf(" % d The number of bit Caprica is : \n", n);
for (m = 1, k = 2;k <= n; k++)m *= 10;
for (w = 1, k = 1 ; k <= n / 2; k++)w *= 10;
c = (long)pow(m, 0.5);
d = (long)pow(10 * m - 1, 0.5); // Find the starting point and ending point of the loop on enumeration
for (b = c + 1; b <= d; b++)
{
a = b * b;
x = floor(a / w);
y = fmod(a, w);//n Bit square a Divided into front and back numbers x、y
if (b == x + y && y >= w / 10) // Segment and condition inspection
printf(" %.0f= (%.0f+%.0f)^2 \n",a,x,y);
}
return 0;
}
result :
// Search for n position 2 Segment sum square
int main()
{
double a, b, m, w, x, y;
long c, d; int k, n, s = 0;
printf(" Please enter a positive integer n (3<n<16:");
scanf(" %d", &n);
for (m = 1, k = 2; k <= n; k++) m *= 10;
c = (long)pow(m, 0.5);
d = (long)pow(10 * m - 1, 0.5);
for (b = c + 1; b <= d; b++)
{
a = b * b;
w = 1;
for (k = 1; k <= n - 1; k++)
{
w *= 10;
x = floor(a / w);
y = fmod(a, w);
if (b == x + y && y > 0)
{
s++;
printf(" % .0f = ( % .0f + % .0f) ^ 2\n", a, x, y);
}
}
}
if (s > 0)
printf(" common %d individual %d position 2 Segment sum square \n", s, n);
else printf(" No, % d position 2 Segment sum square . \n", n) ;
}
result :
//m Bit does not contain 0 Clever square of
int main()
{
int k, m, n, i, x, b[10];
long t, t1, t2, y, d, f;
printf(" hold 1,2,..,9 this 9 Choose a number m individual , ");
printf(" Combine into squares without repeating numbers .\n");
printf(" Please enter the number of square digits m:");
scanf("%d", &m);
n = 0;
t = 1;
for (y = 1; y <= m - 1; y++)
t = t * 10;
t1 = (long)sqrt(t);
t2 = (long)sqrt(10 * t);
for (y = t1 + 1; y <= t2; y++)
{
f = y * y;
d = f;
for (i = 1; i <= 9; i++)
b[i] = 0;
for (x = 0, i = 1; i <= m; i++)
{
k = f % 10;
f = f / 10;
if (k == 0 || (++b[k] > 1))
{
x = 1;
break;
}
}
if (x == 0)
{
n++;
printf(" %1d=%d^2", d, y);
if (n % 3 == 0) printf("\n");
}
}
printf(" \n common %d individual \n", n);
return 0;
}
result :
int main()
{
int k, m, n, t, f[10];
long a, b, c, d, w;
printf(" Numbers 2、3、5、6、7、8、9 The square of the total permutation of :\n");
n = 0;
b = (long)sqrt(2356789);
c = (long)sqrt(9876532);
for (a = b; a <= c; a++)
{
d = a * a; w = d; // Make sure d Is the square number
for (k = 0; k <= 9; k++) f[k] = 0;
while (w > 0)
{
m = w % 10;
f[m]++;
w = w / 10;
}
for (t = 0, k = 1; k <= 9; k++)
if (f[k] > 1) t = 1; // Test whether the three square numbers have duplicate numbers
if (t == 0 && f[0] + f[1] + f[4] == 0) // There is no number in the test square 0、1、4
{
n++;
printf(" %2d:", n);
printf(" %1d=%1d 2 \n", d, a);
}
}
printf(" A total of more than %d individual ", n);
return 0;
}
result :
// Find the Pythagorean array in the specified interval
int main()
{
int a, b, n;
long x, y, z, d;
printf(" Please enter the interval [a,6] The upper and lower a,b: ");
scanf("%d, %d", &a, &b);
printf(" Section [%d,%d] The Pythagorean array in has :\n",a,b);
n=0;
for (x=a;x<=b-2;x++)
for (y = x + 1; y <= b - 1; y++)
{
d = x * x + y * y;
z = sqrt(d); //2 by x, The sum of squares of
if (z > b) break;
if (z * z == d) // Output when the conditions for the number of hook shares are met
{
n++;
printf(" %ld^2+%ld^2=%1d^2 \n", x, y, z);
}
}
printf(" common %d Number of shares in the group ", n);
return 0;
}
result :
//, Find the inverted Pythagorean array in the specified interval
int main()
{
int a, b, n;
long x, y, z;
printf(" Please enter the interval [a,6] The upper and lower a,b: ");
scanf("%d,%d", &a, &b);
printf(" Section [%d,%d] The Pythagorean array in has :\n",a,b);
n=0;
for(z = a; z <= b -2; z++)
for(y = z + 1;y <=b - 1; y++)
for(x = y + 1;x <= b;x++)
if(z*z*( x * x + y * y) == x*x*y*y)
{
n++;
printf(" 1/%ld^2+1/%ld^2=1/%1d^2 \n", x, y, z);
}
printf(" common %d Group handstand hook number ", n);
return 0;
}
result :
边栏推荐
- Free year-end report summary template Welfare Collection
- 變化是永恒的主題
- Scrapy爬虫框架
- [wallpaper] (commercially available) 70 wallpaper HD free
- Sentinel source code analysis part I sentinel overview
- 03 -- QT OpenGL EBO draw triangle
- Bad mentality leads to different results
- Simulation scheduling problem of SystemVerilog (1)
- What does a really excellent CTO look like in my eyes
- High concurrency architecture cache
猜你喜欢

记录在模拟器中运行flutter时报的错

03 -- QT OpenGL EBO draw triangle

Simulation scheduling problem of SystemVerilog (1)
![[optics] vortex generation based on MATLAB [including Matlab source code 1927]](/img/9b/b7f462e2ecbff0cee35e7de5c80cf7.jpg)
[optics] vortex generation based on MATLAB [including Matlab source code 1927]

Help change the socket position of PCB part

Octopus online ecological chain tour Atocha protocol received near grant worth $50000

Merge K ascending linked lists

Buuctf's different flags and simplerev

Integrated easy to pay secondary domain name distribution system

我眼中真正优秀的CTO长啥样
随机推荐
Zhang Fei hardware 90 day learning notes - personal records on day 2, please see my personal profile / homepage for the complete
[proteus simulation] a simple encrypted electronic password lock designed with 24C04 and 1602LCD
Analyse du Code du planificateur ego bspline Section Optimizer (1)
【数学建模】基于matlab船舶三自由度MMG模型【含Matlab源码 1925期】
Buuctf's different flags and simplerev
Sentinel source code analysis part II - sentinel dashboard console startup and configuration
What does a really excellent CTO look like in my eyes
【学术相关】顶级论文创新点怎么找?中国高校首次获CVPR最佳学生论文奖有感...
If the warehouse management communication is not in place, what problems will occur?
math_ Taylor formula
Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext
Driveseg: dynamic driving scene segmentation data set
【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
OSPF - detailed explanation of stub area and full stub area
math_泰勒公式
How to design a high concurrency system
交叉编译Opencv带Contrib
[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]
Simple solution of physical backup and restore of Damon database
QT -- qfile file read / write operation