当前位置:网站首页>1106 2019数列 (15 分)
1106 2019数列 (15 分)
2022-08-11 06:45:00 【呆比特】
题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
String [] array = new String[1000];
array[0] = "2";
array[1] = "0";
array[2] = "1";
array[3] = "9";
//加数
for (int i = 0; i < n-4; i++) {
int sum = Integer.valueOf(array[i]) + Integer.valueOf(array[i+1]) + Integer.valueOf(array[i+2]) + Integer.valueOf(array[i+3]);
String right = sum % 10 + "";
array[i + 4] = right;
}
//有效位抓换成数组、
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < n; i++) {
stringBuilder.append(array[i]);
}
System.out.println(stringBuilder);
}
}
结果:
边栏推荐
- Production and optimization of Unity game leaderboards
- Implement general-purpose, high-performance sorting and quicksort optimizations
- 1688 product interface
- buu—Re(5)
- PIXHAWK飞控使用RTK
- 接口测试的基础流程和用例设计方法你知道吗?
- easyrecovery15数据恢复软件收费吗?功能强大吗?
- concept noun
- 【LeetCode每日一题】——844.比较含退格的字符串
- daily sql - user retention rate for two days
猜你喜欢
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
linux 安装mysql服务报错
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
ROS 服务通信理论模型
第一个C函数:如何实现板级初始化?
【Pytorch】nn.ReLU(inplace=True)
Redis源码-String:Redis String命令、Redis String存储原理、Redis字符串三种编码类型、Redis String SDS源码解析、Redis String应用场景
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
恒源云-Pycharm远程训练避坑指南
Douyin API interface
随机推荐
李沐d2l(十)--卷积层Ⅰ
博途PLC 1200/1500PLC ModbusTcp通信梯形图优化汇总(多服务器多从站轮询)
Amazon API interface Daquan
Pinduoduo api interface application example
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现
第一个C函数:如何实现板级初始化?
机器学习总结(二)
Edge provides label grouping functionality
【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行
Unity3D 学习路线?
LeetCode刷题系列 -- 46. 全排列
mysql视图与索引
Spatial Pyramid Pooling -Spatial Pyramid Pooling (including source code)
daily sql - user retention rate for two days
Activity的四种状态
concept noun
LeetCode brushing series -- 46. Full arrangement
【推荐系统】:协同过滤和基于内容过滤概述
TF中的One-hot
梅科尔工作室——BP神经网络