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

相关推荐
Gofarlic_oms11 小时前
利用API实现ANSYS许可证管理自动化集成
运维·服务器·开发语言·matlab·自动化·负载均衡
AI+程序员在路上3 小时前
VS Code 完全使用指南:下载、安装、核心功能与 内置AI 编程助手实战
开发语言·人工智能·windows·开源
田梓燊3 小时前
力扣:23.合并 K 个升序链表
算法·leetcode·链表
invicinble3 小时前
这里对java的知识体系做一个全域的介绍
java·开发语言·python
catchadmin3 小时前
使用 PHP TrueAsync 改造 Laravel 协程异步化的可行路径
开发语言·php·laravel
wbs_scy3 小时前
【Linux 线程进阶】进程 vs 线程资源划分 + 线程控制全详解
java·开发语言
re林檎3 小时前
算法札记——4.27
算法
AI人工智能+电脑小能手3 小时前
【大白话说Java面试题】【Java基础篇】第15题:JDK1.7中HashMap扩容为什么会发生死循环?如何解决
java·开发语言·数据结构·后端·面试·哈希算法
数据牧羊人的成长笔记4 小时前
逻辑回归与Softmax回归
算法·回归·逻辑回归
郑州光合科技余经理4 小时前
同城O2O海外版二次开发实战:从支付网关到配送算法
开发语言·前端·后端·算法·架构·uni-app·php