【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 微小的

相关推荐
帅次2 分钟前
Kotlin Flow 与 StateFlow:UI 单向数据流基础
开发语言·ui·kotlin·stateflow·onlifecycle
Zachery Pole11 分钟前
CCF-CSP备战NO.6【栈】
算法·深度优先
艾伦野鸽ggg18 分钟前
JavaScript 浏览器本地存储
开发语言·javascript·ecmascript
LJHclasstore_luo22 分钟前
【C++题解】112354.平行时空
数据结构·c++·算法
YYYing.1 小时前
【C++大型项目之高性能服务器框架 (九) 】协议抽象与Http服务器模块
服务器·c++·http·高性能·c/c++·后端框架
AOwhisky1 小时前
Python 学习笔记(第十一期)——运维自动化(上·后篇):进程级监控与子进程管理——psutil进阶
运维·开发语言·python·学习·云原生·运维开发
人工干智能1 小时前
Python 的链式调用:一连串的“点”调用
开发语言·python
ch0sen1pm2 小时前
不太懂 atomic?我花了一下午从 freelist 写到 CAS 无锁栈
c++
就不掉头发2 小时前
如何优化程序的性能
开发语言
手写码匠2 小时前
MCP协议从零实现:手写一个完整的 Model Context Protocol 服务器与客户端
开发语言·数据结构