当前位置:网站首页>第一章:求奇因数代数和,求同吗小数和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;
}
结果:
边栏推荐
- EGO Planner代码解析bspline_optimizer部分(2)
- Day_ 18 IO stream system
- Scrapy爬虫框架
- Scrape crawler framework
- 第二十章:y= sin(x)/x,漫步坐标系计算,y= sin(x)/x 带廓幅图形,奥运五环,小球滚动与弹跳,流水显示,矩形优化裁剪,r个皇后全控nxn棋盘
- [water quality prediction] water quality prediction based on MATLAB Fuzzy Neural Network [including Matlab source code 1923]
- [wallpaper] (commercially available) 70 wallpaper HD free
- Le changement est un thème éternel
- EGO Planner代码解析bspline_optimizer部分(3)
- 第二章:求长方体数组,指定区间内的完全数,改进指定区间内的完全数
猜你喜欢
Free sharing | linefriends hand account inner page | horizontal grid | not for sale
The necessity of lean production and management in sheet metal industry
235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
【光学】基于matlab涡旋光产生【含Matlab源码 1927期】
What is the content of game modeling
Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext
东数西算拉动千亿产业,敢啃“硬骨头”的存储厂商才更有机会
Record: pymysql is used in pycharm to connect to the database
[new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
【LeetCode】【SQL】刷题笔记
随机推荐
flask 生成swagger文档
Help change the socket position of PCB part
Pecan - route
cipher
High concurrency Architecture - read write separation
FBI警告:有人利用AI换脸冒充他人身份进行远程面试
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
【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
Zhang Fei hardware 90 day learning notes - personal records on day 2, please see my personal profile / homepage for the complete
Free year-end report summary template Welfare Collection
第一章:拓广同码小数和s(d, n)
第二十章:y= sin(x)/x,漫步坐标系计算,y= sin(x)/x 带廓幅图形,奥运五环,小球滚动与弹跳,流水显示,矩形优化裁剪,r个皇后全控nxn棋盘
EGO Planner代码解析bspline_optimizer部分(1)
Comments on flowable source code (37) asynchronous job processor
Smart wax therapy machine based on STM32 and smart cloud
Scrapy爬虫框架
Flume learning notes
【光学】基于matlab涡旋光产生【含Matlab源码 1927期】
P3402 persistent and searchable
SSM integration - joint debugging of front and rear protocols (list function, add function, add function status processing, modify function, delete function)