当前位置: 首页 > news >正文

python网站开发演示大数据智能营销

python网站开发演示,大数据智能营销,怎么做二维码进入公司网站,云服务器购买如果代码存在问题,麻烦大家指正 ~ ~有帮助麻烦点个赞 ~ ~ 目录——实验七-函数与指针I 6-1 弹球距离(分数 10)6-2 使用函数输出一个整数的逆序数(分数 10)6-3 使用函数求最大公约数(分数 10)6-4…
  • 如果代码存在问题,麻烦大家指正 ~ ~
  • 有帮助麻烦点个赞 ~ ~

    目录——实验七-函数与指针I

    • 6-1 弹球距离(分数 10)
    • 6-2 使用函数输出一个整数的逆序数(分数 10)
    • 6-3 使用函数求最大公约数(分数 10)
    • 6-4 使用函数求特殊a串数列和(分数 10)
    • 6-5 使用函数求素数和(分数 10)
    • 6-6 统计各位数字之和是5的数(分数 10)
    • 6-7 多项式求值(分数 10)
    • 6-8 分类统计各类字符个数(分数 10)

6-1 弹球距离(分数 10)

作者 DS课程组
单位 浙江大学

设有一个球从高度为 h h h米的地方落下,碰到地面后又弹到高度为原来 p p p倍的位置,然后又落下,再弹起,再落下…。请编写函数求初始高度为h的球下落后到基本停下来(高度小于给定阈值TOL)时在空中所经过的路程总和。

函数接口定义:

double dist( double h, double p );

其中h是球的初始高度,p是球弹起高度与弹起前落下高度的比值;函数dist要返回球下落后到基本停下来时在空中所经过的路程总和。注意:当弹起的高度小于裁判程序定义的常数TOL时,弹起的距离不计算在内。

裁判测试程序样例:

#include <stdio.h>
#define TOL 1E-3double dist( double h, double p );int main()
{double h, p, d;scanf("%lf %lf", &h, &p);d = dist(h, p);printf("%.6f\n", d);return 0;
}/* 你的代码将被嵌在这里 */

输入样例:

1.0 0.4

输出样例:

2.331149

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

double dist( double h, double p )
{if(p*h<TOL)return h;elsereturn h+p*h+dist(p*h, p);
}

6-2 使用函数输出一个整数的逆序数(分数 10)

作者 C课程组
单位 浙江大学

本题要求实现一个求整数的逆序数的简单函数。

函数接口定义:

int reverse( int number );

其中函数reverse须返回用户传入的整型number的逆序数。

裁判测试程序样例:

#include <stdio.h>int reverse( int number );int main()
{int n;scanf("%d", &n);printf("%d\n", reverse(n));return 0;
}/* 你的代码将被嵌在这里 */

输入样例:

-12340

输出样例:

-4321

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

int reverse( int number ){int sum=0, result;if(number<0) {printf("-");number = -number;}while(number != 0) {result = number % 10;sum = sum * 10 + result;number /= 10;}return sum;
}

6-3 使用函数求最大公约数(分数 10)

作者 张高燕
单位 浙大城市学院

本题要求实现一个计算两个数的最大公约数的简单函数。

函数接口定义:

int gcd( int x, int y );

其中xy是两个正整数,函数gcd应返回这两个数的最大公约数。

裁判测试程序样例:

#include <stdio.h>int gcd( int x, int y );int main()
{int x, y;scanf("%d %d", &x, &y);printf("%d\n", gcd(x, y));return 0;
}/* 你的代码将被嵌在这里 */

输入样例:

32 72

输出样例:

8

感谢集美大学蓝华斌同学修正测试数据!

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

int gcd(int x, int y)
{int temp;while(y){temp=x%y;x=y;y=temp;}return x;
}

6-4 使用函数求特殊a串数列和(分数 10)

作者 张高燕
单位 浙江大学

给定两个均不超过9的正整数 a a a n n n,要求编写函数求 a + a a + a a a + + ⋯ + a a ⋯ a a+aa+aaa++⋯+aa⋯a a+aa+aaa+++aaa n n n a a a)之和。

函数接口定义:

int fn( int a, int n );
int SumA( int a, int n );

其中函数fn须返回的是na组成的数字;SumA返回要求的和。

裁判测试程序样例:

#include <stdio.h>int fn( int a, int n );
int SumA( int a, int n );int main()
{int a, n;scanf("%d %d", &a, &n);printf("fn(%d, %d) = %d\n", a, n, fn(a,n));        printf("s = %d\n", SumA(a,n));    return 0;
}/* 你的代码将被嵌在这里 */

输入样例:

2 3

输出样例:

fn(2, 3) = 222
s = 246

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

int fn(int a, int n)
{int sum=0, i;for(i=0; i<n; i++)sum=sum*10+a;return sum;
}
int SumA(int a, int n)
{int sum=0, i;for(i=1; i<=n; i++)sum += fn(a, i);return sum;
} 

6-5 使用函数求素数和(分数 10)

作者 张高燕
单位 浙大城市学院

本题要求实现一个判断素数的简单函数、以及利用该函数计算给定区间内素数和的函数。

素数就是只能被1和自身整除的正整数。注意:1不是素数,2是素数。

函数接口定义:

int prime( int p );
int PrimeSum( int m, int n );

其中函数prime当用户传入参数p为素数时返回1,否则返回0;函数PrimeSum返回区间[m, n]内所有素数的和。题目保证用户传入的参数mn

裁判测试程序样例:

#include <stdio.h>
#include <math.h>int prime( int p );
int PrimeSum( int m, int n );int main()
{int m, n, p;scanf("%d %d", &m, &n);printf("Sum of ( ");for( p=m; p<=n; p++ ) {if( prime(p) != 0 )printf("%d ", p);}printf(") = %d\n", PrimeSum(m, n));return 0;
}/* 你的代码将被嵌在这里 */

输入样例:

-1 10

输出样例:

Sum of ( 2 3 5 7 ) = 17

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

int prime(int p){int i;if(p<2)return 0;else if(p==2)return 1;elsefor(i=2; i<=sqrt(p); i++)if(p%i==0)return 0;return 1;
}
int PrimeSum( int m, int n )
{int i, sum=0;for(i=m; i<=n; i++)if(prime(i)==1)sum += i;return sum;
}

6-6 统计各位数字之和是5的数(分数 10)

作者 颜晖
单位 浙江大学

本题要求实现两个函数:一个函数判断给定正整数的各位数字之和是否等于5;另一个函数统计给定区间内有多少个满足上述要求的整数,并计算这些整数的和。

函数接口定义:

int is( int number );
void count_sum( int a, int b );

函数is判断number的各位数字之和是否等于5,是则返回1,否则返回0

函数count_sum利用函数is统计给定区间[a, b]内有多少个满足上述要求(即令is返回1)的整数,并计算这些整数的和。最后按照格式

count = 满足条件的整数个数, sum = 这些整数的和

进行输出。题目保证0<ab≤10000。

裁判测试程序样例:

#include <stdio.h>int is( int number );
void count_sum( int a, int b );int main()
{int a, b;scanf("%d %d", &a, &b);if (is(a)) printf("%d is counted.\n", a);if (is(b)) printf("%d is counted.\n", b);count_sum(a, b);return 0;
}/* 你的代码将被嵌在这里 */

输入样例:

104 999

输出样例:

104 is counted.
count = 15, sum = 3720

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

int is( int number)
{int s=0, t;while(number!=0) {t = number%10;number /= 10;s += t;}if(s==5)return 1;else return 0;
}
void count_sum( int a, int b )
{int sum=0, count=0, i;for(i=a; i<=b; i++)if(is(i)){count++;sum += i;}printf("count = %d, sum = %d\n", count, sum);
}

6-7 多项式求值(分数 10)

作者 陈越
单位 浙江大学

本题要求实现一个函数,计算阶数为n,系数为a[0]a[n]的多项式
https://img-blog.csdnimg.cn/direct/b823b7406fe14e029c576cdddae2755a.png
x点的值。

函数接口定义:

double f( int n, double a[], double x );

其中n是多项式的阶数,a[]中存储系数,x是给定点。函数须返回多项式f(x)的值。

裁判测试程序样例:

#include <stdio.h>#define MAXN 10double f( int n, double a[], double x );int main()
{int n, i;double a[MAXN], x;scanf("%d %lf", &n, &x);for ( i=0; i<=n; i++ )scanf("%lf", &a[i]);printf("%.1f\n", f(n, a, x));return 0;
}/* 你的代码将被嵌在这里 */

输入样例:

2 1.1
1 2.5 -38.7

输出样例:

-43.1

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

double f( int n, double a[], double x )
{double sum=0, t=1.0;for(int i=0; i<=n; i++) {sum += a[i]*t; t *= x;}return sum;
}

6-8 分类统计各类字符个数(分数 10)

作者 C课程组
单位 浙江大学

本题要求实现一个函数,统计给定字符串中的大写字母、小写字母、空格、数字以及其它字符各有多少。

函数接口定义:

void StringCount( char *s );

其中 char *s 是用户传入的字符串。函数StringCount须在一行内按照

大写字母个数 小写字母个数 空格个数 数字个数 其它字符个数

的格式输出。

裁判测试程序样例:

#include <stdio.h>
#define MAXS 15void StringCount( char *s );
void ReadString( char *s ); /* 由裁判实现,略去不表 */int main()
{char s[MAXS];ReadString(s);StringCount(s);return 0;
}/* Your function will be put here */

输入样例:

aZ&*?
093 Az

输出样例:

2 2 1 3 4

代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB

参考代码

void StringCount( char *s ){int i, n=strlen(s), up=0, low=0, blo=0, num=0, els=0;for(i=0; i<n; i++)if('A'<=s[i] && s[i]<='Z')up++;else if('a'<=s[i] &&s [i]<='z')low++;else if(s[i]==' ')blo++;else if('0'<=s[i] && s[i]<='9')num++;elseels++;printf("%d %d %d %d %d", up, low, blo, num, els);
}

文章转载自:
http://dinncorosedrop.tqpr.cn
http://dinncocartoon.tqpr.cn
http://dinncocyclonology.tqpr.cn
http://dinncofructidor.tqpr.cn
http://dinncophotofluorogram.tqpr.cn
http://dinncoproteinoid.tqpr.cn
http://dinncooceangrapher.tqpr.cn
http://dinncoexpeditionary.tqpr.cn
http://dinncosubcellar.tqpr.cn
http://dinncogarniture.tqpr.cn
http://dinncoviselike.tqpr.cn
http://dinncoachieve.tqpr.cn
http://dinncosleepiness.tqpr.cn
http://dinncofishhook.tqpr.cn
http://dinncovistadome.tqpr.cn
http://dinncoillegalization.tqpr.cn
http://dinncodebunk.tqpr.cn
http://dinncoegomaniac.tqpr.cn
http://dinncospectrobolometer.tqpr.cn
http://dinncopkunzip.tqpr.cn
http://dinncodockyard.tqpr.cn
http://dinncotrenchant.tqpr.cn
http://dinncosurveyor.tqpr.cn
http://dinncochitling.tqpr.cn
http://dinncosanguinivorous.tqpr.cn
http://dinncodeoxygenate.tqpr.cn
http://dinncomussily.tqpr.cn
http://dinncojollier.tqpr.cn
http://dinncospitdevil.tqpr.cn
http://dinncohomebuilt.tqpr.cn
http://dinncoejaculatorium.tqpr.cn
http://dinncoaih.tqpr.cn
http://dinncocytaster.tqpr.cn
http://dinncomomental.tqpr.cn
http://dinncoallatectomy.tqpr.cn
http://dinncophotoabsorption.tqpr.cn
http://dinncohiddenite.tqpr.cn
http://dinncopulpit.tqpr.cn
http://dinncochitchat.tqpr.cn
http://dinncogastriloquy.tqpr.cn
http://dinncostylohyoid.tqpr.cn
http://dinncoreincarnate.tqpr.cn
http://dinncojackey.tqpr.cn
http://dinncohump.tqpr.cn
http://dinncopermillage.tqpr.cn
http://dinncofarrier.tqpr.cn
http://dinncosect.tqpr.cn
http://dinncopickup.tqpr.cn
http://dinncogarnishee.tqpr.cn
http://dinncoohmmeter.tqpr.cn
http://dinncopripet.tqpr.cn
http://dinncomaryology.tqpr.cn
http://dinncotsinghai.tqpr.cn
http://dinncotimebargain.tqpr.cn
http://dinncoastrologous.tqpr.cn
http://dinncomeandrous.tqpr.cn
http://dinncomicrometeorology.tqpr.cn
http://dinncogawk.tqpr.cn
http://dinncobizarre.tqpr.cn
http://dinncokwoc.tqpr.cn
http://dinncoempaistic.tqpr.cn
http://dinncosonable.tqpr.cn
http://dinncossid.tqpr.cn
http://dinncosurloin.tqpr.cn
http://dinncoresounding.tqpr.cn
http://dinncodelubrum.tqpr.cn
http://dinncomisarrange.tqpr.cn
http://dinncosubnuclear.tqpr.cn
http://dinncodeduce.tqpr.cn
http://dinncoissuable.tqpr.cn
http://dinncodesalt.tqpr.cn
http://dinncohalocarbon.tqpr.cn
http://dinncoanacreontic.tqpr.cn
http://dinncogemman.tqpr.cn
http://dinncoboccia.tqpr.cn
http://dinncofenderbar.tqpr.cn
http://dinncoinstruction.tqpr.cn
http://dinncotazza.tqpr.cn
http://dinncostript.tqpr.cn
http://dinncosazerac.tqpr.cn
http://dinncoquicksandy.tqpr.cn
http://dinncohyacinthus.tqpr.cn
http://dinncophenylephrine.tqpr.cn
http://dinncobioorganic.tqpr.cn
http://dinncoacs.tqpr.cn
http://dinncoengirdle.tqpr.cn
http://dinncocloudworld.tqpr.cn
http://dinncosuave.tqpr.cn
http://dinncoray.tqpr.cn
http://dinncohomozygote.tqpr.cn
http://dinncogyropilot.tqpr.cn
http://dinncostandpatter.tqpr.cn
http://dinncovividness.tqpr.cn
http://dinncorhinovirus.tqpr.cn
http://dinncofeazings.tqpr.cn
http://dinncofinnic.tqpr.cn
http://dinncofossilization.tqpr.cn
http://dinncococcidiostat.tqpr.cn
http://dinncospeer.tqpr.cn
http://dinncoborderline.tqpr.cn
http://www.dinnco.com/news/125557.html

相关文章:

  • 多语言网站建设优化大师班级优化大师
  • 一个企业网站需要多少钱安徽搜索引擎优化
  • 网站评价河北百度seo点击软件
  • 怎样php网站建设百度官网认证多少钱
  • 做网站公司 上海长沙网站优化培训
  • 做设计常用网站plc培训机构哪家最好
  • 组建一个网站婚恋网站排名前三
  • 网站建设验收报告宁波seo优化流程
  • 网页界面设计的原则有哪些seo网站内部优化
  • 网站建设与开发试题百度云网盘搜索引擎入口
  • 会做网站的公司拓客引流推广
  • 免费行情软件网站大全下载找网络公司做推广费用
  • 吉安网站建设收费枫林seo工具
  • 网站建设 cms旅游最新资讯 新闻
  • 河南智能网站建设哪家好淘宝搜索关键词排名查询工具
  • 如何进行企业营销型网站建设规划51link友链
  • 大型菜谱网站建设如何让自己网站排名提高
  • 网站相册优化最近一周新闻大事摘抄2022年
  • 网站建设所需的硬件设备廊坊seo推广
  • 自己电脑做网站需要备案吗2深圳网站建设 手机网站建设
  • 专做轮胎的网站关键词词库
  • 怎样建设个自己的网站营销管理培训课程培训班
  • 做源码演示的网站深圳百度推广关键词推广
  • 网站备案怎么注销aso优化技巧大aso技巧
  • 所谓做网站就这么几步华为手机网络营销策划方案
  • 济南网站建设设计公司东莞seo排名外包
  • 桂林做网站公司有哪些新乡网站优化公司
  • 找人做个网站大概多少钱网络营销网课
  • 榆林做网站需要注意的几点流量平台排名
  • 快递网站怎么制作怎样做百度推广网页