当前位置:网站首页>The recursive recursive Fighting_ silver study ah but level 4
The recursive recursive Fighting_ silver study ah but level 4
2022-08-10 13:21:00 【51CTO】
Approximate title:
There are n seats in a row, and at least two seats are vacant between every two people, and the practice in the case of at least one person is required.
Thinking:
a[n] is all practices that have n seats.Assuming that the previous actions have been arranged, there are two situations for the nth seat, someone does it and no one does it. When someone does it, n-1 and n-2 must be done by no one, so the sitting method and a[n-3] is the same, when no one is sitting, it is the same as sitting on a[n-1], but there is another case, that is, when there is only one person sitting, on a[n]Sitting by one person is also considered a situation, so the formula a[n]=a[n-1]+a[n-3]+1 is obtained.
Thinking:
This question is a bit difficult to think about, but it is not difficult to think that all the sitting methods can be deduced by formula, and generally the latter data is related to the former, but it is easy to add one at the endForget it, but when debugging, you will find that each number will be smaller by 1, and if you think about it carefully, you will find the error.
Code:
边栏推荐
- 鸿蒙开发从hello world开始
- [Advanced Digital IC Verification] Difference and focus analysis between SoC system verification and IP module verification
- Open Office XML 格式里如何描述多段具有不同字体设置的段落
- bgp dual plane experiment routing strategy to control traffic
- 【mysql索引实现原理】
- LeetCode中等题之颠倒字符串中的单词
- LeetCode·每日一题·640.求解方程·模拟构造
- 【目标检测】小脚本:提取训练集图片与标签并更新索引
- iTextSharp 使用详解
- Codeforces Round #276 (Div. 1) D. Kindergarten
猜你喜欢

来看Prada大秀吗?在元宇宙里那种!

海外邮件发送指南(二)

iTextSharp操作PDF

Solution for "Certificate not valid for requested usage" after Digicert EV certificate signing

Efficient and Robust 2D-to-BEV Representation Learning via Geometry-guided Kernel Transformer Paper Notes

商汤自研机械臂,首款产品是AI下棋机器人:还请郭晶晶作代言

Real-time data warehouse practice of Baidu user product flow and batch integration

shell:常用小工具(sort、uniq、tr、cut)

How to describe multiple paragraphs with different font settings in Open Office XML format

Keithley DMM7510 accurate measurement of ultra-low power consumption equipment all kinds of operation mode power consumption
随机推荐
【百度统计】用户行为分析
浙大、阿里提出DictBERT,字典描述知识增强的预训练语言模型
YTU 2295: KMP模式匹配 一(串)
Twikoo腾讯云函数部署转移到私有部署
mSystems | 中农汪杰组揭示影响土壤“塑料际”微生物群落的机制
Ethernet channel Ethernet channel
wirshark 常用操作及 tcp 三次握手过程实例分析
C#中导入其它自定义的命名空间
中科院深圳先进技术院合成所赵国屏院士组2022年招聘启事
九宫格抽奖动效
2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。 package main import ( “fmt“ “syn
C# InitializeComponent() does not exist in the current context
bgp dual plane experiment routing strategy to control traffic
Reversing words in a string in LeetCode
神了!阿里数据库专家纯手写了这份604页的Oracle+MySQL攻坚指南
娄底石油化工实验设计、建设规划概述
Nanodlp v2.2/v3.0光固化电路板,机械开关/光电开关/接近开关的接法和系统状态电平设置
Fragment的show和hide
Import other custom namespaces in C#
把相亲角搬到海外,不愧是咱爸妈