题目58:素数表

问题描述

从键盘输入m,n

在屏幕上按每行10个的格式输出m~n之间的全部素数。

请用函数判断一个数是否素数。

输入说明

两个整数m n

输出说明

[m,n]之间(包含m和n)的素数,每行10个,每个数后跟一个空格。

输入范例

2 33

输出范例

2 3 5 7 11 13 17 19 23 29 
31 

代码
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

bool IsPrime(int x)
{
	if(x == 1)	return false;
	for(int i = 2; i <= sqrt(x); i ++)
	{
		if(x % i == 0)	return false;
	}
	return true;
}
 int main()
 {
	int m, n;
	int cnt = 0;
	cin >> m >> n;
	for(int i = m; i <= n; i ++)
	{
		if(IsPrime(i))
		{
			cout << i << ' ';
			cnt ++;
			if(cnt % 10 == 0)	cout << endl;
		}
	}
    return 0;
 }

题目59:倒数数列

问题描述

编写程序计算并输出

s=sumk=1n (1/k) = 1+1/2+1/3+............+1/n 的值。

要求定义并调用函数total(n)计算1+1/2+1/3+......+1/n

注意:此题的main函数如下所示:
 

int main(){

 int n;

 scanf("%d",&n);

 printf("%.3f\n",total(n));

 return 0;

}

或者:

int main(){

 int n;

 cin>>n;

 cout<<fixed<<setprecision(3)<<total(n)<<endl;

 return 0;

}

输入说明

正整数n,表示前n项求和

输出说明

s,表示前n项的和

首尾无空格

输入范例

2

输出范例

1.500

代码
 
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;

double total(int n)
{
	double sum = 0;
	for(int i = 1; i <= n; i ++)
	{
		sum += 1.0 / i;
	}
	return sum;
}

 int main()
 {
	int n;
	cin >> n;
	cout << fixed << setprecision(3) << total(n) << endl;
    return 0;
 }

题目60:排列数

问题描述

编写程序计算排列数

要求定义函数fact(n)计算n的阶乘。

main函数中可使用如下形式调用:fact(m)/fact(m-n));
 

输入说明

两个数m、n

输出说明
输入范例

3 2

输出范例
6
代码
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;

int fact(int x)
{
	int ans = 1;
	for(int i = 1; i <= x; i ++)
	{
		ans *= i;
	}
	return ans;
}

 int main()
 {
	int m, n;
	cin >> m >> n;
	cout << fact(m) / fact(m - n); 
    return 0;
 }

英语翻译

        AR can also be helpful for a sales person who is trying to demonstrate the virtues of a product. Especially for complex devices, it may be difficult to convey the internal operation with words alone. Letting a potential customer observe the animated interior allows for much more compelling presentations at trade shows and in show rooms alike.

        AR技术也对正尝试表达产品优势的销售人员很有帮助。特别是对复杂的仪器来说,可能很难单独靠言语传达内部的运作原理。让潜在的消费者观察到动态的内部,能让许多在贸易展览和展览室的产品展示都更加令人信服

show room (商品样品的)陈列室,展览室

        Pictofit is a virtual dressing room application that lets users preview garments from online fashion stores on their own body (Figure 12B-4). The garments are automatically adjusted to match the wearer's size. In addition, body measurements are estimated and made available to assist in the entry of purchase data.

        Pictofit是一款虚拟的试衣间应用,该应用能让用户从在线潮流门店预览衣服穿在他们自己身上(图12B-4)。这些衣服能自动调整来匹配穿着者的尺码。此外,身体尺寸会被评估,并可以协助进入购买信息的填写。

dressing room 试衣室,试衣间

Figure 12B-4: Pictofit can extract garment images from online shoppingsites and render them to match an image of the customer

图12B-4:Pictofit能够从线上购物平台提取衣服图像,并将它们渲染得与消费者图像相匹配。

garment /'ɡɑːmənt/ n.(一件)衣服

render /'rendə/ v. 对…做艺术处理(或进行渲染)

augment /ɔːɡ'ment/ v. 增强;增加;扩大

augmented reality 增强现实

indistinguishable /ˌindis'tiŋɡwi∫əbəl/ a. 难以区别的,难以分辨的

detach /di'tæt∫/ v. 拆卸;使分开;使分离

proposition /ˌprɔpə'zi∫ən/ n. 提议,建议

overlay /ˌəuvə'lei/ v. 置(一物)于他物之上;在…上覆盖

amplify /'æmplifai/ v. 放大;增强;扩大

cognitive /'kɔɡnitiv/ a. 认识的,认知的

misconception /ˌmiskən'sep∫ən/ n. 误解,错误想法

Jurassic /ʤu'ræsik/ n. & a. 侏罗纪(的)

avatar /'ævətɑː/ n. 化身(印度教和佛教中化作人形或兽形的神)

interactivity /ˌintəræk'tiviti/ n. 交互性

real time 实时

haptic /'hæptik/ a. 触觉的

olfactory /ɔl'fæktəri/ a. 嗅觉的

gustatory /'ɡʌstətəri/ a. 味觉的

alignment /ə'lainmənt/ n. 对准,对齐

mandate /'mændeit/ n. 授权;命令;指令

augmentation /ˌɔːɡmen'tei∫ən/ n. 增强;增加;扩大

situated /'sitjueitid, -t∫u-/ a. 位于…的;处于…境地的

situated visualization 情境可视化,位置可视化

showcase /'∫əukeis/ v. 陈列;展示

memorize /'meməraiz/ v. 记住;熟记

superimpose /ˌsjuːpərim'pəuz/ v. 添加;附加;叠加

instrumentation /ˌinstrumen'teiən, ˌinstrə-/ n. 仪表化;装设仪器;(一套)仪器

telepresence /'teliˌprezəns/ n. 远程呈现

conferencing /'kɔnfərənsiŋ/ n. 召开会议;会议技术

video conferencing (召开)视频会议;视频会议技术

collaborative /kə'læbəreitiv/ a. 合作的,协作的

geo-coordinate /ˌʤiːəukəu'ɔːdinət/ n. 地理坐标

compelling /kəm'peliŋ/ a. 令人信服的;有强烈吸引力的

footage /'futiʤ/ n.(影片的)连续镜头,片段

yardage /'jɑːdiʤ/ n. 码数;以码计量的长度

screencast /'skriːnkɑːst/ n. 截屏视频,屏幕录像,录屏

overlay /'əuvəlei/ n. 覆盖物

hockey /'hɔki/ n. 曲棍球;冰上曲棍球,冰球

ice hockey 冰上曲棍球,冰球

televise /'telivaiz/ v. 用电视播放

incarnation /ˌinkɑː'neiən/ n.(某种品质、概念、思想等的)典型体现,化身

albeit /ɔːl'biːit/ conj. 尽管,即使

informative /in'fɔːmətiv/ a. 提供有用信息的;增长知识的

rendering /'rendəriŋ/ n. 艺术处理;渲染

branding /'brændiŋ/ n. 品牌推广,品牌宣传

logo /'ləuɡəu/ n. 标识,标志,徽标

moderator /'mɔdəreitə/ n.(电视或广播节目的)主持人

prop /prɔp/ n.(戏剧、电影等中用的)道具

preview /'priːvjuː/ n. & v. 预映;试演;预看

compositing /'kɔmpəzitiŋ, kəm'pɔz-/ n. 混合;合成

kiosk /'kiːɔsk, ki'ɔsk/ n. 亭子;信息亭

vantage /'vɑːntiʤ; 'væn-/ n. 优势;有利地位

vantage point 有利位置;观点,看法

flyer /'flaiə/ n.(广告)传单

prophet /'prɔfit/ n. 预言者,预言家

animated /'ænimeitid/ a. 动画(片)的;活生生的

show room (商品样品的)陈列室,展览室

dressing room 试衣室,试衣间

garment /'ɡɑːmənt/ n.(一件)衣服

render /'rendə/ v. 对…做艺术处理(或进行渲染)

单词打卡

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐