当前位置:网站首页>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 :
边栏推荐
- [new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
- TFs and SVN [closed] - TFs vs SVN [closed]
- Flutter网络和数据存储框架搭建 -b1
- SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
- 【LeetCode】【SQL】刷题笔记
- Summary of 90 day learning materials and notes of Zhang Fei's actual electronic hardware engineer
- 第一章:递归求n的阶乘n!
- P3402 persistent and searchable
- Buuctf's different flags and simplerev
- DriveSeg:动态驾驶场景分割数据集
猜你喜欢
I study database at station B (4): DQL
The earliest record
Verilog HDL continuous assignment statement, process assignment statement, process continuous assignment statement
【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁
Flutter network and data storage framework construction-b1
Summary of composition materials for 2020 high-frequency examination center of educational resources
How to build an efficient information warehouse
【光学】基于matlab涡旋光产生【含Matlab源码 1927期】
What is the content of game modeling
If the warehouse management communication is not in place, what problems will occur?
随机推荐
Simple solution of physical backup and restore of Damon database
The more you talk, the more your stupidity will be exposed.
【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
Smart wax therapy machine based on STM32 and smart cloud
“google is not defined” when using Google Maps V3 in Firefox remotely
During MySQL installation, the download interface is empty, and the components to be downloaded are not displayed. MySQL installer 8.0.28.0 download interface is empty solution
Thinking about festivals
[optics] vortex generation based on MATLAB [including Matlab source code 1927]
Record: pymysql is used in pycharm to connect to the database
How to build an efficient information warehouse
TFs and SVN [closed] - TFs vs SVN [closed]
Buuctf's different flags and simplerev
达梦数据库的物理备份和还原简解
Redis master-slave synchronization, clustering, persistence
01. Preparation for automated office (free guidance, only three steps)
The installation path cannot be selected when installing MySQL 8.0.23
Sentinel source code analysis part I sentinel overview
Read the paper glodyne global topology preserving dynamic network embedding
We have built an intelligent retail settlement platform
记录在模拟器中运行flutter时报的错