当前位置:网站首页>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);
}
}
结果:
边栏推荐
- 囍楽云任务源码
- sql--Users who have purchased more than 3 times (inclusive) within 7 days (including the current day), and the purchase amount in the past 7 days exceeds 1,000
- 从苹果、SpaceX等高科技企业的产品发布会看企业产品战略和敏捷开发的关系
- JD.com product details API call example explanation
- LeetCode brushing series -- 46. Full arrangement
- 接入网、承载网、核心网是什么,交换机路由器是什么、这个和网络的协议有什么关系呢?
- 联想集团:2022/23财年第一季度业绩
- Daily SQL - find each of the students school gpa minimum (window)
- TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
- When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
猜你喜欢
exness:黄金1800关口遇阻,静待美国CPI出炉
Pinduoduo API interface
SQL sliding window
Pinduoduo api interface application example
恒源云-Pycharm远程训练避坑指南
技能在赛题解析:交换机防环路设置
Implement general-purpose, high-performance sorting and quicksort optimizations
【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行
结合均线分析k线图的基本知识
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
随机推荐
数仓开发知识总结
maxwell concept
【sdx62】XBL设置共享内存变量,然后内核层获取变量实现
囍楽云任务源码
【Pytorch】nn.ReLU(inplace=True)
redis操作
2022-08-10 Group 4 Self-cultivation class study notes (every day)
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
关于Android Service服务的面试题
2022-08-09 第四小组 修身课 学习笔记(every day)
Douyin API interface
Shell:三剑客之awk
结合均线分析k线图的基本知识
梅科尔工作室——BP神经网络
DDR4内存条电路设计
Unity开发者必备的C#脚本技巧
年薪40W测试工程师成长之路,你在哪个阶段?
微信小程序功能上新(2022.06.01~2022.08.04)
opencv实现数据增强(图片+标签)平移,翻转,缩放,旋转
2022-08-10 第四小组 修身课 学习笔记(every day)