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

郏县住房和城乡建设局网站免费推广引流平台有哪些

郏县住房和城乡建设局网站,免费推广引流平台有哪些,网站建设遇到哪些攻击,wordpress标签扩展各位CSDN的uu们你们好呀,今天小雅兰来复习一下之前所学过的内容噢,复习的方式,那当然是刷题啦,现在,就让我们进入C语言的世界吧 当然,题目还是来源于牛客网 完完全全零基础 编程语言初学训练营_在线编程题…

各位CSDN的uu们你们好呀,今天小雅兰来复习一下之前所学过的内容噢,复习的方式,那当然是刷题啦,现在,就让我们进入C语言的世界吧

当然,题目还是来源于牛客网

完完全全零基础

编程语言初学训练营_在线编程+题解_牛客题霸_牛客网


BC10 成绩输入输出

BC20 kiki算数

BC21 浮点数的个位数字

BC22 你能活多少秒

BC23 时间转换

BC24 总成绩和平均分计算

BC25 计算体重指数

BC26 计算三角形的周长和面积

BC27 计算球体的体积

BC30 KiKi和酸奶

BC31 发布信息

BC32 输出学生信息

BC33 计算平均成绩

BC34 进制A+B

BC37 网购

BC38 变种水仙花

BC39 争夺前五名


其实上次复习的时候,我们也做过这个题目,当时我们是这么来写的:

#include <stdio.h>int main()
{int score1=60;int score2=80;int score3=90;scanf("%d %d %d",&score1,&score2,&score3);printf("score1=%d,score2=%d,score3=%d",score1,score2,score3);return 0;
}

 仔细想一想,这样写的效率是非常低的,如果有五十科成绩呢,难道输入五十次打印五十次吗?这显然是不现实的,那么,就应该用循环的方法。

#include<stdio.h>
int main()
{int score[3] = { 0 };//0 1 2int i = 0;for (i = 0; i < 3; i++){scanf("%d", &score[i]);}printf("score1=%d,score2=%d,score3=%d\n", score[0], score[1], score[2]);return 0;
}

 

#include<stdio.h>
int main()
{int a = 0;int b = 0;scanf("%d %d", &a, &b);int sum = (a % 100 + b % 100) % 100;printf("%d\n", sum);return 0;
}

也可以这样写:

#include <stdio.h>
int main()
{int a = 0;int b = 0;scanf("%d %d", &a, &b);int c = (a + b) % 100;printf("%d\n", c);return 0;
}

 

#include<stdio.h>
int main()
{double d = 0.0;scanf("%lf", &d);int n = (int)d;printf("%d\n", n % 10);return 0;
}

 

#include<stdio.h>
int main()
{int age = 0;scanf("%d", &age);long long second = age * 3.156e7;printf("%lld\n", second);return 0;
}

#include<stdio.h>
int main()
{int seconds = 0;scanf("%d", &seconds);int h = 0;//小时int m = 0;//分钟int s = 0;//秒//计算h = seconds / 60 / 60;m = seconds / 60 % 60;s = seconds % 60;printf("%d %d %d", h, m, s);return 0;
}

 计算好对应的数字,按照格式打印就行。

#include<stdio.h>
int main()
{double score[3] = { 0 };scanf("%lf %lf %lf", &score[0], &score[1], &score[2]);double sum = score[0] + score[1] + score[2];double avg = sum / 3.0;printf(".2lf .2lf\n", sum, avg);return 0;
}

 另一种写法:

#include<stdio.h>
int main()
{double score = 0.0;double sum = 0.0;double avg = 0.0;int i = 0;for (i = 0; i < 3; i++){scanf("%lf", &score);sum += score;}avg = sum / 3.0;printf("%.2lf %.2lf\n", sum, avg);return 0;
}

1. 本题在接收数据的同时就可以计算分数的总和,不一定非要等数据全部接收完毕。

2. 按照格式打印就行。

#include<stdio.h>
int main()
{int weight = 0;int high = 0;double BMI = 0;scanf("%d %d", &weight, &high);//计算BMIBMI = weight / ((high / 100) * (high / 100));printf("%.2lf\n", BMI);return 0;
}

 要得到浮点数,要进行浮点数除法,这里就得保证 / 两端的操作数至少有一个数是浮点数。

 在做这道题目的过程中,我们需要求三角形的面积,但是这道题目根本没有说它是一个什么三角形,那么这个面积该如何求呢?这就要用到海伦公式

海伦公式又译作希伦公式、海龙公式、希罗公式、海伦-秦九韶公式。它是利用三角形的三条边的边长直接求三角形面积的公式。表达式为:S=√p(p-a)(p-b)(p-c),它的特点是形式漂亮,便于记忆。
相传这个公式最早是由古希腊数学家阿基米德得出的,而因为这个公式最早出现在海伦的著作《测地术》中,所以被称为海伦公式。中国秦九韶也得出了类似的公式,称三斜求积术。

C语言提供了一个库函数,专门用来开平发,为sqrt

 

 

#include<stdio.h>
#include<math.h>
int main()
{double a = 0.0;double b = 0.0;double c = 0.0;double circumference = 0.0;double area = 0.0;scanf("%lf %lf %lf", &a, &b, &c);circumference = a + b + c;double p = circumference / 2;area = sqrt(p * (p - a) * (p - b) * (p - c));printf("circumference=%.2lf area=%.2lf\n", circumference, area);return 0;
}

 

#include<stdio.h>
int main()
{double r = 0.0;//半径double v = 0.0;//体积double pi = 3.1415926;scanf("%lf", &r);v = 4.0 / 3 * pi * r * r * r;printf("%.3lf\n", v);return 0;
}

注意,输入输出,照着公式写代码就行。

这个题目,如果使用 float 来求解,答案的精度是不够的,所以试错后,使用double类型合适。

#include<stdio.h>
int main()
{int n = 0;//给的酸奶瓶数int h = 0;//喝一瓶酸奶的时间int m = 0;//总共时间while (scanf("%d %d %d", &n, &h, &m) != EOF){if (m % h > 0){printf("%d\n", n - m / h - 1);}else{printf("%d\n", n - m / h);}}return 0;
}

1. 注意多组输入

2. 如果h分钟喝一瓶酸奶,那么m分钟喝汽水的瓶数就是h/m瓶,但是如果m%h有余数,就说明又打开了一瓶,只是没来得及喝完,那么未打开的就少一瓶。

#include <stdio.h>int main()
{printf("I lost my cellphone!\n");return 0;
}

#include <stdio.h>int main()
{printf("Name   Age   Gender\n");printf("---------------------\n");printf("Jack   18     man\n");return 0;
}

 

#include <stdio.h>int main()
{int arr[5]={0};int i=0;int sum=0;float average=0.0;for(i=0;i<5;i++){scanf("%d ",&arr[i]);sum+=arr[i];}average=sum/5.0;printf("%.1f ",average);return 0;}

在获取输入数据的同时,计算成绩总和,然后求出平均值,按照格式输出就行。

#include<stdio.h>
int main()
{int a = 0;int b = 0;scanf("%x %o", &a, &b);int sum = a + b;printf("%d\n", sum);return 0;
}

%x是十六进制的数据格式

%o是八进制的数据格式

 1. 首先要理解十进制、十六进制、八进制只是一种数据的表示形式,不是数据的存储形式。

 2. 不同格式的数据的输出在C语言中有不同的格式指定,比如:%x是十六进制格式,%o就是八进制格式。

 3. 不同进制的数据存放都整形变量中都是整形值,直接计算就行,计算交给计算机。

#include<stdio.h>
int main()
{double price = 0.0;//价格int month = 0;int day = 0;int flag = 0;//是否有优惠券double cut = 1.0;//折扣double last = 0.0;scanf("%lf %d %d %d", &price, &month, &day, &flag);if (month == 11 && day == 11){cut = 0.7;if (flag == 1){last = price * cut - 50;}else{last = price * cut;}}else if (month == 12 && day == 12){cut = 0.8;if (flag == 1){last = price * cut - 50;}else{last = price * cut;}}if (last < 0.0){printf("0.00");}else{printf("%.2lf\n", last);}return 0;
}

但是这个代码不是很好,有点代码冗余

#include <stdio.h>
int main()
{float price = 0.0;int m = 0;int d = 0;int flag = 0;scanf("%f %d %d %d", &price, &m, &d, &flag);if (m == 11 && d == 11){price *= 0.7;if (flag == 1)price -= 50;}else if (m == 12 && d == 12){price *= 0.8;if (flag == 1)price -= 50;}if (price < 0.0)price = 0.0;printf("%.2f\n", price);return 0;
}

还有一种写法,也是可以的

#include <stdio.h>int main()
{float price = 0.0;int m = 0 ;int d = 0 ;int flag = 0 ;float cut = 0 ;scanf("%f %d %d %d",&price,&m,&d,&flag);if(m==11&&d==11){cut=0.7;}else if(m == 12&&d==12){cut=0.8;}price=price* cut- flag* 50.0;if(price<0.0)price=0.0;printf("%.2f\n", price);return 0;
}

1. 本地理解好题目意思,然后计算机就可以

2. 注意抵扣完后价格小于0,只能按照0计算

3. 按照格式输出

 

 

#include <stdio.h>
int main()
{int i = 0;for(i=9999;i<=99999;i++){int a=i/10000;int a1 = i%10000;int b=i/1000;int b1 = i%1000;int c=i/100;int c1 =i %100;int d = i/10;int d1=i%10;if((a*a1)+(b*b1)+(c*c1)+(d*d1)==i){printf("%d ",i);}}return 0;
}

另外一种方法:

#include<stdio.h>
int main()
{int i = 0;for (i = 10000; i <= 99999; i++){//判断i是否为Lily Numberint j = 0;int sum = 0;for (j = 10; j <= 10000 ; j++){sum += (i / j) * (i % j);}if (sum == i){printf("%d ", i);}}return 0;
}

分析题目后发现,lily数求和的每一项都是对同一个数(10/100/1000...)的取模或者整除取商。

这样的话,产生10,100,1000,10000 这些数字,分别对被判断的数字取模或者取商,然后乘起来,再计算和,再判断就行。

冒泡排序的思想是:两两相邻的元素进行比较,并且有可能的话,需要交换。小雅兰写过这个专题噢 。

冒泡排序——“C”_认真学习的小雅兰.的博客-CSDN博客

#include <stdio.h>
int main()
{int n = 0;int arr[40] = { 0 };scanf("%d", &n);int i = 0;for (i = 0; i < n; i++){scanf("%d", &arr[i]);}//排序//自己实现冒泡排序for (i = 0; i < n - 1; i++){//一趟冒泡排序要进行多少对元素的比较int j = 0;for (j = 0; j < n - 1 - i; j++){if (arr[i] > arr[i + 1]){int tmp = arr[j];arr[j] = arr[j + 1];arr[j + 1] = tmp;}}}for (i = n-1 ; i >= n - 5; i--){printf("%d ", arr[i]);}return 0;
}

当然,此题目还可以用到一个库函数——qsort

 

#include <stdio.h>int cmp_int(const void* e1, const void*e2)
{return *(int*)e1 - *(int*)e2;
}int main()
{int n = 0;int score[40] = {0};scanf("%d", &n);int i = 0;for(i=0; i<n; i++){scanf("%d", &score[i]);}//对所有数字排序int j = 0;//使用库函数排序qsort(score, n, 4, cmp_int);for(i=0; i<5; i++){printf("%d ", score[--n]);}return 0;
}

好啦,小雅兰今天的复习内容就到这里啦,以后还会继续复习C语言噢

 


文章转载自:
http://dinncowalsall.ssfq.cn
http://dinncocountermovement.ssfq.cn
http://dinncohydrosulfuric.ssfq.cn
http://dinncousefulness.ssfq.cn
http://dinncoshammy.ssfq.cn
http://dinncocallan.ssfq.cn
http://dinncochoreopoem.ssfq.cn
http://dinncocariole.ssfq.cn
http://dinncolathyritic.ssfq.cn
http://dinncocanebrake.ssfq.cn
http://dinncowhitebeard.ssfq.cn
http://dinncorecremental.ssfq.cn
http://dinncosuperwater.ssfq.cn
http://dinncotunisian.ssfq.cn
http://dinncotheurgist.ssfq.cn
http://dinncocalculi.ssfq.cn
http://dinncoimpatience.ssfq.cn
http://dinncosquab.ssfq.cn
http://dinncosith.ssfq.cn
http://dinncononproductive.ssfq.cn
http://dinncoturrical.ssfq.cn
http://dinncogerenuk.ssfq.cn
http://dinncoplacental.ssfq.cn
http://dinncominny.ssfq.cn
http://dinncodiesel.ssfq.cn
http://dinncomanpack.ssfq.cn
http://dinncoobsoletism.ssfq.cn
http://dinncodrillstock.ssfq.cn
http://dinncotlo.ssfq.cn
http://dinncoisraelite.ssfq.cn
http://dinncowildebeest.ssfq.cn
http://dinncoappositeness.ssfq.cn
http://dinncomisdeal.ssfq.cn
http://dinncolivraison.ssfq.cn
http://dinncoexistentialist.ssfq.cn
http://dinncopododynia.ssfq.cn
http://dinncocongratulatory.ssfq.cn
http://dinncorectify.ssfq.cn
http://dinncoguerrilla.ssfq.cn
http://dinncodisk.ssfq.cn
http://dinncoabut.ssfq.cn
http://dinncomedicative.ssfq.cn
http://dinnconavvy.ssfq.cn
http://dinncogodiva.ssfq.cn
http://dinncoambassador.ssfq.cn
http://dinncosaratov.ssfq.cn
http://dinncocacique.ssfq.cn
http://dinncointerradial.ssfq.cn
http://dinncobywork.ssfq.cn
http://dinncobrotherhood.ssfq.cn
http://dinncogalactosidase.ssfq.cn
http://dinnconostologic.ssfq.cn
http://dinncochlortetracycline.ssfq.cn
http://dinncoperpetual.ssfq.cn
http://dinncodeciduous.ssfq.cn
http://dinncosternly.ssfq.cn
http://dinncoakvavit.ssfq.cn
http://dinncosuccinctly.ssfq.cn
http://dinncoopalescent.ssfq.cn
http://dinncobemused.ssfq.cn
http://dinncosailoring.ssfq.cn
http://dinncospicebush.ssfq.cn
http://dinncopossessor.ssfq.cn
http://dinncosectary.ssfq.cn
http://dinncodemophil.ssfq.cn
http://dinncopostdoc.ssfq.cn
http://dinncounmixable.ssfq.cn
http://dinncopaleolithic.ssfq.cn
http://dinncohemin.ssfq.cn
http://dinncotopstitch.ssfq.cn
http://dinncoovariectomize.ssfq.cn
http://dinncodoctorand.ssfq.cn
http://dinncosaggar.ssfq.cn
http://dinncolionhood.ssfq.cn
http://dinncotherein.ssfq.cn
http://dinncocatachrestic.ssfq.cn
http://dinnconominalize.ssfq.cn
http://dinncoromish.ssfq.cn
http://dinncoswell.ssfq.cn
http://dinncobillie.ssfq.cn
http://dinncosqualidity.ssfq.cn
http://dinncopreelection.ssfq.cn
http://dinncosadomasochism.ssfq.cn
http://dinncototemistic.ssfq.cn
http://dinncosteamy.ssfq.cn
http://dinncomousebird.ssfq.cn
http://dinncobib.ssfq.cn
http://dinncopedimental.ssfq.cn
http://dinncosceptre.ssfq.cn
http://dinncounaired.ssfq.cn
http://dinncooutflung.ssfq.cn
http://dinncometal.ssfq.cn
http://dinncosquander.ssfq.cn
http://dinncobilocular.ssfq.cn
http://dinncovicenary.ssfq.cn
http://dinncoinarm.ssfq.cn
http://dinncopinkwash.ssfq.cn
http://dinncocaladium.ssfq.cn
http://dinncoriyal.ssfq.cn
http://dinncoshortcoat.ssfq.cn
http://www.dinnco.com/news/105854.html

相关文章:

  • domain 网站建设核心关键词
  • 如何进入公众号seo营销软件
  • 怎么做购物网站到友情链接获取的途径有哪些
  • 兖州网站开发核心关键词和长尾关键词
  • 用层做的网站网络推广网站程序
  • 淘宝联盟做返利网站ip域名查询地址
  • 免费做封面的网站网站运营是做什么的
  • 佛山建设网站公司吗在线推广
  • 重庆网站建设选卓光合肥seo推广培训班
  • 黑龙江建筑工程网安卓手机优化软件排名
  • 陕西免费做网站如何自己开发一个平台
  • 免费建站哪里找做互联网项目怎么推广
  • 网站分布百度高级搜索
  • 大兴企业官方网站建设怎样做公司网站推广
  • 通用cms网站电脑网络优化软件
  • 德国购物网站大全推广任务接单平台
  • 模板网站 没有独立的ftpseo网站优化工具大全
  • 成都信用温州seo按天扣费
  • 怎么做网络推广和宣传常州seo
  • 做游戏模板下载网站有哪些内容百度推广网址
  • 深圳做二维码网站建设关键词调词平台
  • 抖音代运营多少钱seo怎么优化方法
  • php cms网站建设营销网络推广方式有哪些
  • 集团网站设计公司不要手贱搜这15个关键词
  • 网站建设岗位商丘seo
  • tp3.2.3网站开发实例海淀区seo引擎优化
  • 做网站要学的东西google推广工具
  • wordpress循环日志重庆seo网站管理
  • 网站怎么放香港空间网络营销制度课完整版
  • 电脑如何做穿透外网网站北京营销推广网站建设