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

相关推荐
骇客野人7 分钟前
Java BIO / NIO / AIO 完整详解 + 编程技巧
java·开发语言·nio
霸道流氓气质10 分钟前
OpenTelemetry 入门与实战:Java Agent、Spring Boot Starter与LLM调用追踪示例
java·开发语言·spring boot
波力海苔夹心脆67515 分钟前
C# 机器视觉实战:单相机引导机械手精准贴合,从拍照、偏差计算(平移+旋转)到坐标补偿全解
开发语言·经验分享·数码相机·c#·视觉检测·.net
聪明蛋子哟24 分钟前
不仅仅是向量检索:结合知识图谱与Tool Calling的混合增强生成(Hybrid RAG)方案
人工智能·算法·知识图谱
Pniubi25 分钟前
力扣55跳跃游戏(贪心)
算法·leetcode·游戏
外收内放34 分钟前
Python基础语法练习题(62原始版本及其优化版本)
开发语言·python
马剑威(威哥爱编程)36 分钟前
【AI全栈后端12-12】Spring Boot 3.x 到 4.x 迁移实操:Jakarta 11、Jackson 3 与 AI 2.0
java·开发语言·spring boot·后端
三月微暖寻春笋1 小时前
【和春笋一起学C++】(七十二)类模板
开发语言·c++·实例·类模板·使用类模板·数组模板
xlq223221 小时前
全面复习4
c++
释厄6231 小时前
智能体释放度子集律——文本 ⊂ 音频 ⊂ 视频⊂ 游戏
开发语言·游戏·microsoft·音视频