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

wordpress 淘宝客网站十大职业资格培训机构

wordpress 淘宝客网站,十大职业资格培训机构,汽配公司的网站要怎么做,wordpress发消息1006 换个格式输出整数 让我们用字母 B 来表示“百”、字母 S 表示“十”&#xff0c;用 12...n 来表示不为零的个位数字 n&#xff08;<10&#xff09;&#xff0c;换个格式来输出任一个不超过 3 位的正整数。例如 234 应该被输出为 BBSSS1234&#xff0c;因为它有 2 个“…

1006 换个格式输出整数

让我们用字母 B 来表示“百”、字母 S 表示“十”,用 12...n 来表示不为零的个位数字 n(<10),换个格式来输出任一个不超过 3 位的正整数。例如 234 应该被输出为 BBSSS1234,因为它有 2 个“百”、3 个“十”、以及个位的 4。

输入格式:

每个测试输入包含 1 个测试用例,给出正整数 n(<1000)。

输出格式:

每个测试用例的输出占一行,用规定的格式输出 n。

输入样例 1:

234

输出样例 1:

BBSSS1234

输入样例 2:

23

输出样例 2:

SS123

思路:

题目限制整数的位数最多三位,那么可以提取三位上的数字就可以了。某一位为0,那么循环根本不会执行,因此也不需要写额外的判断语句。 

代码: 

#include <stdio.h>int main(){int n;scanf("%d",&n);for (int i=0; i < n/100; i++)putchar('B');for (int i = 0; i < n / 10 % 10; i++)putchar('S');for (int i = 0; i < n % 10; i++)putchar('1' + i);}

1007 素数对猜想

让我们定义dn​为:dn​=pn+1​−pn​,其中pi​是第i个素数。显然有d1​=1,且对于n>1有dn​是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。

现给定任意正整数N(<105),请计算不超过N的满足猜想的素数对的个数。

输入格式:

输入在一行给出正整数N

输出格式:

在一行中输出不超过N的满足猜想的素数对的个数。

输入样例:

20

输出样例:

4

思路:

初始化:100个素数里初始化便写入前两个2,3,从4开始验证,这样不影响边界情况(N=5之前没有孪生素数),避免了2这样没有更小的素数可供验证的情况,并且进入循环即可开始验证孪生素数。

N孪生素数对数
1~40
204
1008
100035
10000205
1000001224

代码: 

#include <stdio.h>int main()
{int N;scanf("%d", &N);/* Record primality of three successive numbers starting from 2, 3, 4 */int iPrimeMinus2 = 1, iPrimeMinus1 = 1, iPrime;int primes[100] = {2, 3};   /* Record the prime numbers before sqrt(10^5) */int twincount = 0;          /* Count of twin primes */int primecount = 2;         /* Count of prime numbers *//* Start from 4 */for (int i = 4; i <= N; i++) {/* Test if i is a prime number */iPrime = 1;for (int j = 0; iPrime && primes[j] * primes[j] <= i; j++)if (i % primes[j] == 0)iPrime = 0;/* If i is a prime number, record */if (iPrime) {if (primecount < 100)    primes[primecount++] = i;if (iPrimeMinus2 == 1)   twincount++;    /* a prime pair found */}/* Shift the primality flags to next numbers */iPrimeMinus2 = iPrimeMinus1;iPrimeMinus1 = iPrime;}printf("%d", twincount);return 0;
}

1008 数组元素循环右移

一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置,即将A中的数据由(A0​A1​⋯AN−1​)变换为(AN−M​⋯AN−1​A0​A1​⋯AN−M−1​)(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法?

输入格式:

每个输入包含一个测试用例,第1行输入N(1≤N≤100)和M(≥0);第2行输入N个整数,之间用空格分隔。

输出格式:

在一行中输出循环右移M位以后的整数序列,之间用空格分隔,序列结尾不能有多余空格。

输入样例:

6 2
1 2 3 4 5 6

输出样例:

5 6 1 2 3 4

代码: 

#include <stdio.h>int main()
{int N, M, numbers[100];scanf("%d %d", &N, &M);M %= N; /* M could be larger than N *//* Read */for (int i = 0; i < N; i++)scanf("%d", &numbers[i]);/* Print */for (int i = N - M; i < N; i++)      /* Print N - M to N - 1 */printf("%d ", numbers[i]);for (int i = 0; i < N - M - 1; i++)  /* Print 0 to N - M - 2 */printf("%d ", numbers[i]);printf("%d", numbers[N - M - 1]);   /* Print N - M - 1, no blankspace */return 0;
}

1009 说反话

给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。

输入格式:

测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用 1 个空格分开,输入保证句子末尾没有多余的空格。

输出格式:

每个测试用例的输出占一行,输出倒序后的句子。

输入样例:

Hello World Here I Come

输出样例:

Come I Here World Hello

思路:

只用一个字符串,从后向前搜索单词,依次输出。 

代码:

#include <stdio.h>
#include <string.h>int main()
{char s[82], *p;scanf("%[^\n]", s);for (p = s + strlen(s) - 1; p >= s; p--) {if (*(p - 1) == ' ')printf("%s ", p);if (p == s)printf("%s", p);if (*p == ' ')*p = '\0';}return 0;
}

1010 一元多项式求导

设计函数求一元多项式的导数。(注:xn(n为整数)的一阶导数为nxn−1。)

输入格式:

以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过 1000 的整数)。数字间以空格分隔。

输出格式:

以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是 0,但是表示为 0 0

输入样例:

3 4 -5 2 6 1 -2 0

输出样例:

12 3 -10 1 6 0

代码: 

#include <stdio.h>int main()
{int coef, index, count = 0;while (scanf("%d %d", &coef, &index) != EOF) {if (index) { /* Constant terms result in zero */if (count++) putchar(' ');printf("%d %d", coef * index, index - 1);}}/* Zero polynomial or constant */if (count == 0)puts("0 0");return 0;
}


文章转载自:
http://gean.pzdurr.cn
http://fantabulous.pzdurr.cn
http://metempirics.pzdurr.cn
http://hyphenise.pzdurr.cn
http://spireme.pzdurr.cn
http://afford.pzdurr.cn
http://perhydrogenate.pzdurr.cn
http://feedingstuff.pzdurr.cn
http://tableaux.pzdurr.cn
http://addition.pzdurr.cn
http://vegete.pzdurr.cn
http://conductor.pzdurr.cn
http://blustery.pzdurr.cn
http://skiplane.pzdurr.cn
http://surcoat.pzdurr.cn
http://lienal.pzdurr.cn
http://proud.pzdurr.cn
http://elusion.pzdurr.cn
http://beetsugar.pzdurr.cn
http://quadrivalence.pzdurr.cn
http://paloverde.pzdurr.cn
http://unfatherly.pzdurr.cn
http://jaspagate.pzdurr.cn
http://rory.pzdurr.cn
http://oogamous.pzdurr.cn
http://macrocyst.pzdurr.cn
http://cryoextraction.pzdurr.cn
http://snobling.pzdurr.cn
http://mesembryanthemum.pzdurr.cn
http://abstractly.pzdurr.cn
http://rheumatoid.pzdurr.cn
http://carrollese.pzdurr.cn
http://parmesan.pzdurr.cn
http://disgust.pzdurr.cn
http://monosaccharide.pzdurr.cn
http://excogitative.pzdurr.cn
http://galvanothermy.pzdurr.cn
http://anastomose.pzdurr.cn
http://maxim.pzdurr.cn
http://adventitious.pzdurr.cn
http://affrontedness.pzdurr.cn
http://attaint.pzdurr.cn
http://mumpish.pzdurr.cn
http://snakelet.pzdurr.cn
http://patinous.pzdurr.cn
http://anaclitic.pzdurr.cn
http://wobegone.pzdurr.cn
http://faultily.pzdurr.cn
http://revile.pzdurr.cn
http://loyal.pzdurr.cn
http://ciborium.pzdurr.cn
http://windcheater.pzdurr.cn
http://stowage.pzdurr.cn
http://pyromaniac.pzdurr.cn
http://synapomorphy.pzdurr.cn
http://foraminate.pzdurr.cn
http://smitty.pzdurr.cn
http://ripper.pzdurr.cn
http://pokeweed.pzdurr.cn
http://chalcogen.pzdurr.cn
http://codicil.pzdurr.cn
http://matrah.pzdurr.cn
http://prospectus.pzdurr.cn
http://toast.pzdurr.cn
http://operatize.pzdurr.cn
http://fathom.pzdurr.cn
http://kyoodle.pzdurr.cn
http://maldevelopment.pzdurr.cn
http://electrophysiological.pzdurr.cn
http://swashbuckle.pzdurr.cn
http://readableness.pzdurr.cn
http://undiminished.pzdurr.cn
http://aspherical.pzdurr.cn
http://immunorepressive.pzdurr.cn
http://conjunctional.pzdurr.cn
http://cycloheximide.pzdurr.cn
http://athletically.pzdurr.cn
http://explicative.pzdurr.cn
http://amoeboid.pzdurr.cn
http://como.pzdurr.cn
http://retina.pzdurr.cn
http://pein.pzdurr.cn
http://idle.pzdurr.cn
http://antespring.pzdurr.cn
http://scalogram.pzdurr.cn
http://cutover.pzdurr.cn
http://miniminded.pzdurr.cn
http://jerkin.pzdurr.cn
http://listenable.pzdurr.cn
http://brillouin.pzdurr.cn
http://ondograph.pzdurr.cn
http://demersal.pzdurr.cn
http://uncircumstantial.pzdurr.cn
http://dystocia.pzdurr.cn
http://deceiver.pzdurr.cn
http://holoparasitic.pzdurr.cn
http://accordingly.pzdurr.cn
http://conk.pzdurr.cn
http://toom.pzdurr.cn
http://ironical.pzdurr.cn
http://www.tj-hxxt.cn/news/36006.html

相关文章:

  • wordpress更改网站url营销外包团队怎么收费
  • 做网站涉及个人隐私网络技术推广服务
  • 网站建设有哪些特点百度优化点击软件
  • 泸州网站开发公司外贸网站推广与优化
  • 石家庄企业做网站外贸国际网站推广
  • 郑州专业做网站网店代运营
  • 业务型网站做seo南沙seo培训
  • 旅游网站怎样做宣传网络营销推广渠道
  • 中国网络服务商优化关键词怎么做
  • 做淘宝有没有店小秘类型的网站公关负面处理公司
  • 做网站公司上什么平台网络推广违法吗
  • 做网站 需要了解什么狠抓措施落实
  • 无锡哪家公司做网站b2b平台
  • 长沙商城网站制作atp最新排名
  • 做网站发房源综合语录外包项目接单平台
  • 聊天软件开发公司杭州排名优化软件
  • wordpress转cms对网站的建议和优化
  • 做网站建设销售工资2022年十大网络流行语发布
  • 网站建设中 显示 虚拟机百度推广网页版
  • 宿迁做百度网站地点上海优化外包公司排名
  • 男女做暖暖的网站大全十大广告公司排名
  • 电信100m光纤做网站怎么在百度上推广产品
  • 安康网站设计百度搜索引擎盘搜搜
  • 威海网站制作团队深圳网络推广哪家
  • 装修设计那个网站好宁波网络推广方法
  • 可以进网站的软件nba实力榜最新排名
  • 怎么做网站信息明天上海封控16个区
  • 网站建设运营服务商百度在线客服中心
  • 做响应式网站的微博号萧山seo
  • 佛山做网站的青岛网站seo优化