当前位置:网站首页>1106 2019 Sequence (15 points)
1106 2019 Sequence (15 points)
2022-08-11 07:48:00 【dumb bit】
题目要求:
代码:
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;
}
//Convert valid bits to array、
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < n; i++) {
stringBuilder.append(array[i]);
}
System.out.println(stringBuilder);
}
}
结果:
边栏推荐
猜你喜欢
随机推荐
C语言每日一练——Day02:求最小公倍数(3种方法)
There may be fields that cannot be serialized in the abnormal object of cdc and sqlserver. Is there anyone who can understand it? Help me to answer
流式结构化数据计算语言的进化与新选择
Tidb二进制集群搭建
测试用例很难?有手就行
Edge 提供了标签分组功能
PIXHAWK飞控使用RTK
【LaTex-错误和异常】\verb ended by end of line.原因是因为闭合边界符没有在\verb命令所属行中出现;\verb命令的正确和错误用法、verbatim环境的用法
Go语言实现Etcd服务发现(Etcd & Service Discovery & Go)
2022-08-10 Group 4 Self-cultivation class study notes (every day)
那些事情是用Unity开发项目应该一开始规划好的?如何避免后期酿成巨坑?
pytorch,numpy两种方法实现nms类间+类内
CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
2022年中国软饮料市场洞察
易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!
伦敦银规则有哪些?
1081 检查密码 (15 分)
TF中的One-hot
What are the things that should be planned from the beginning when developing a project with Unity?How to avoid a huge pit in the later stage?
一张图了解JVM八大原子操作









