当前位置:网站首页>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滑动窗口
JD.com product details API call example explanation
Discourse's Close Topic and Reopen Topic
tf中自减操作;tf.assign_sub()
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
下一代 无线局域网--强健性
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
公牛10-11德里克·罗斯最强赛季记录
随机推荐
NFT 的价值从何而来
maxwell concept
Taobao API common interface and acquisition method
JD.com product details API call example explanation
Taobao sku API interface (PHP example)
2022-08-09 Group 4 Self-cultivation class study notes (every day)
从 dpdk-20.11 移植 intel E810 百 G 网卡 pmd 驱动到 dpdk-16.04 中
NTT的Another Me技术助力创造歌舞伎演员中村狮童的数字孪生体,将在 “Cho Kabuki 2022 Powered by NTT”舞台剧中首次亮相
mysql视图与索引
Edge 提供了标签分组功能
SQL sliding window
LeetCode刷题系列 -- 46. 全排列
梅科尔工作室——BP神经网络
golang fork 进程的三种方式
2022-08-09 第四小组 修身课 学习笔记(every day)
Amazon API interface Daquan
Pinduoduo API interface (attach my available API)
How to choose professional, safe and high-performance remote control software
Unity游戏排行榜的制作与优化
囍楽云任务源码