当前位置:网站首页>第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
2022-07-03 19:18:00 【股_四】
//求奇因数代数和
int main()
{
int d, m, n;
long s;
printf("请输入整数n:");
scanf("%d",&n);
s = 0;
for(m = 1; m <= n; m++)
{
if(m % 2 > 0) s = s + m;
else
{
d = m;
while(d % 2 == 0) d = d / 2;
s = s - d;
}
}
printf(" s(%d) = %ld\n", n, s);
return 0;
}
结果验证:
//求同吗小数和s(d, n)
int main()
{
int d, j, n;
double t, s;
printf(" 请输入整数d, n:");
scanf("%d, %d", &d, &n);
t = s = 0;
for (j = 1; j < n; j++)
{
t = t / 10 + (double)d / 10;
s += t;
}
printf(" S(%d, %d) = %.8f\n", d, n, s);
return 0;
}
结果验证:
//简化同码小数和s(d, n)
int main()
{
int d, n;
double s;
printf(" 请输入整数d, n");
scanf("%d,%d", &d, &n);
s = (n - 0.111111111) * d / 9;
printf(" s(%d, %d) = %.8f\n", d, n, s);
return 0;
}
结果验证:
//拓广同码小数和s(d, n)
int main()
{
int a, b, d, j, n;
double t, s;
printf(" 请输入整数d, n; ");
scanf("%d, %d", &d, &n);
a = d;
b = 1;
while (a > 0)
{
b = b * 10;
a = a / 10;
}
t = s = 0;
for (j = 1; j <= n; j++)
{
t = t / b + (double)d / b;
s += t;
}
printf(" s(%d, %d) = %.8f\n", d, n, s);
return 0;
}
结果:
边栏推荐
- Integrated easy to pay secondary domain name distribution system
- 为什么要做特征的归一化/标准化?
- EGO Planner代码解析bspline_optimizer部分(3)
- Web Security (VII) specific process of authentication with session cookie scheme
- These problems should be paid attention to in the production of enterprise promotional videos
- Why should the gradient be manually cleared before back propagation in pytorch?
- Dynamic planning -- expansion topics
- [mathematical modeling] ship three degree of freedom MMG model based on MATLAB [including Matlab source code 1925]
- Using the visualization results, click to appear the corresponding sentence
- Record: MySQL changes the time zone
猜你喜欢

BUUCTF

What is the content of game modeling

Record: pymysql is used in pycharm to connect to the database

Counting from the East and counting from the West will stimulate 100 billion industries. Only storage manufacturers who dare to bite the "hard bone" will have more opportunities

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

235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】

EGO Planner代码解析bspline_optimizer部分(3)

Smart wax therapy machine based on STM32 and smart cloud

FBI警告:有人利用AI换脸冒充他人身份进行远程面试

【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁
随机推荐
math_ Taylor formula
第二章:求长方体数组,指定区间内的完全数,改进指定区间内的完全数
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
QT -- qfile file read / write operation
P1891 crazy LCM (Euler function)
[water quality prediction] water quality prediction based on MATLAB Fuzzy Neural Network [including Matlab source code 1923]
Streaming media server (16) -- figure out the difference between live broadcast and on-demand
第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数
第一章:拓广同码小数和s(d, n)
Bad mentality leads to different results
P3402 persistent and searchable
Smart wax therapy machine based on STM32 and smart cloud
Read the paper glodyne global topology preserving dynamic network embedding
Nous avons fait une plateforme intelligente de règlement de détail
Sustainable service business models
Help change the socket position of PCB part
235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]
[optics] vortex generation based on MATLAB [including Matlab source code 1927]
Which do MySQL and Oracle learn?
Zhang Fei hardware 90 day learning notes - personal record on day 5. Please see my personal profile / homepage for the complete record