【day53】

进阶7:

最近FJ为他的奶牛们开设了数学分析课,FJ知道若要学好这门课,必须有一个好的三角函数基本功。所以他准备和奶牛们做一个"Sine之舞"的游戏,寓教于乐,提高奶牛们的计算能力。

不妨设

An=sin(1+sin(2-sin(3+sin(4-...sin(n))...)

Sn=(...(A1+n)A2+n-1)A3+...+2)An+1

FJ想让奶牛们计算Sn的值,请你帮助FJ打印出Sn的完整表达式,以方便奶牛们做题。

个人总结:

  1. 注意括号的数量
cpp 复制代码
#include<iostream>
#include<string.h>
using namespace std;
string itos(int n) {
	string s = "";
	while (n) {
		int temp = n % 10;
		s = (char)(temp + '0')+s;
		n /= 10;
	}
	return s;
}
string an(int n) {
	if (n == 1)return "sin(1)";
	char op;
	if ((n - 1) % 2 == 0)op = '-';
	else op = '+';
	string former = an(n - 1);
	string b = "";
	for (int i = 0; i < n; i++)b += ")";//括号也要增加
	return former.substr(0, former.size() - n+1) + op + "sin(" + itos(n) + b;//将An-1最后两个右括号去掉,再加新字符串
}
string sn(int add, int k, int n) {
	if (k == n) {
		return an(k) + "+" + itos(add);
	}
	string b = "";
	if (k == 1) {
		for (int i = 0; i < n - 1; i++) b += "(";
	}
	return b + an(k) + "+" + itos(add) + ")" + sn(add - 1, k + 1, n);
}
int main() {
	int n;
	cin >> n;
	cout << sn(n,1,n) << endl;
	return 0;
}

ROM (read-only memory) contains a small set of instructionsand data called the boot loader. The boot loader instructions tell a digital device how to start. Typically, the boot loader performs self-tests to find out if the hardware is operating properly andmay also verify that essential programs have not been corrupted.It then loads the operating system into RAM. Whereas RAM istemporary and volatile, ROM is more permanent and non-volatile. The contents of ROM remain in place even when thedevice is turned off.

ROM只读存储器存储了引导加载程序的一系列指令和数据。引导加载指令告诉数字设备如何启动。引导加载程序执行自我检测,检查硬件是否在正确运行以及确保基础程序没有被损坏。接着加载操作系统进RAM。然而RAM具有临时性和易变性,ROM具有长久性和非易变性。ROM存储的内容,即使设备关闭的时候,仍然保持在原位。

Most computers have additional memory devices called mass storage (or secondary storage) systems. Three types are commonly used for personal computers: magnetic, optical, and solid state.

大多数计算机都有被称为大容量存储(或辅助存储)系统的额外存储设备。个人计算机常用的有三种类型:磁性存储、光学存储和固态存储。

Magnetic storage represents data by magnetizing microscopic particles on a disk or tape surface. The first personal computers used cassette tapes for storage, though floppy disk storage was soon available. Today, the most common example of magneticstorage technology is the magnetic disk or hard disk drive (HDD).

磁存储通过将磁盘或磁带表面的微小颗粒磁化来表示数据。最早的个人计算机使用盒式磁带进行存储,不过软盘存储很快就出现了。如今,磁存储技术最常见的例子是磁盘或硬盘驱动器(HDD)。

  • microscopic 微小的

相关推荐
iPadiPhone2 小时前
Java 泛型与通配符全链路解析及面试进阶
java·开发语言·后端·面试
历程里程碑2 小时前
36 Linux线程池实战:日志与策略模式解析
开发语言·数据结构·数据库·c++·算法·leetcode·哈希算法
haiyaoyouyou2 小时前
Qt ElaWidgetTools 编译运行示例
开发语言·qt·qt creator·elaframework·mingw_64
lzp07912 小时前
python爬虫——爬取全年天气数据并做可视化分析
开发语言·爬虫·python
可编程芯片开发2 小时前
基于自适应MUSIC算法的波束形成matlab仿真
算法·matlab·波束形成·自适应music
白藏y2 小时前
【C++】特殊类设计与单例模式
c++·单例模式
会编程的土豆2 小时前
C语言实现:影院票务管理系统(铠甲怪兽管理系统)(详细解析+效果展示)C语言实现:影院票务管理系统(铠甲怪兽管理系统)(详细解析+效果展示)
c语言·开发语言·课程设计·项目·管理系统
2301_789015622 小时前
DS进阶:红黑树
c语言·开发语言·数据结构·c++·算法·r-tree·lsm-tree
¿i?2 小时前
吃什么?作业复习LinkedList==DEBUG
数据结构·c++·学习