目录
第 1 题:斐波那契与7
问题描述
答案提交
运行限制
代码:
第 2 题:小蓝做实验
问题描述
答案提交
运行限制
代码:
问题描述
斐波那契数列的递推公式为: Fn=Fn−1+Fn−2, 其中 F1=F2=1 。
请问, 斐波那契数列的第 1 至 202202011200 项(含)中, 有多少项的个位 是 7 。
答案提交
这是一道结果填空的题, 你只需要算出结果后提交即可。本题的结果为一 个整数, 在提交答案时只填写这个整数, 填写多余的内容将无法得分。
运行限制
- 最大运行时间:1s
- 最大运行内存: 512M
package 第十四届蓝桥杯三月真题刷题训练.day15;import java.math.BigInteger;/*** @author yx* @date 2023-03-17 23:51*/
public class 斐波那契与7 {public static void main(String[] args) {BigInteger bigInteger=new BigInteger("202202011200");//个位数字60个为一循环,自己纸上写一下就好BigInteger bigInteger1=new BigInteger("60");//60个数字里面有8个7BigInteger bigInteger2=new BigInteger("8");System.out.println(bigInteger.mod(bigInteger1));System.out.println(bigInteger.divide(bigInteger1).multiply(bigInteger2));}
}
问题描述
小蓝很喜欢科研, 他最近做了一个实验得到了一批实验数据, 一共是两百万个正整数。
如果按照预期, 所有的实验数据 x 都应该满足 10^7≤x≤10^8 。
但是做实验都会有一些误差, 会导致出现一些预期外的数据, 这种误差数据 y 的 范围是 10^3≤y≤10^12。由于小蓝做实验很可靠, 所以他所有的实验数据中 99.99%以上都是符合预期的。
小蓝的所有实验数据都在 primes.txt 中, 现 在他想统计这两百万个正整数中有多少个是质数, 你能告诉他吗?
答案提交
这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一 个整数, 在提交答案时只填写这个整数, 填写多余的内容将无法得分。
运行限制
- 最大运行时间:1s
- 最大运行内存: 512M
package 第十四届蓝桥杯三月真题刷题训练.day15;import java.io.*;
import java.math.BigInteger;/*** @author yx* @date 2023-03-18 0:51*/
public class 小蓝做实验__读文件_大数的质数判断 {static PrintWriter out =new PrintWriter(System.out);static BufferedReader ins=new BufferedReader(new InputStreamReader(System.in));static StreamTokenizer in=new StreamTokenizer(ins);/*** 输入* in.nextToken()* int a= (int)in.nval;* * 输出* out.print();* out.flush();*/public static void main(String[] args) throws IOException {BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("C:\\Users\\yx\\Desktop\\primes.txt")));int count = 0;while (true) {String s = br.readLine();if (s == null)break;BigInteger a = new BigInteger(s);//10表示概率的意思if (a.isProbablePrime(10)) {count++;}}System.out.println(count);}}
上一篇:最新或2023(历届)我眼中的安全手抄报 安全在心中的手抄报 2020国家安全手抄报带有字的 2022年安全手抄报大a4纸的
下一篇:English Learning - L2 语音作业打卡 辅音舌齿龈音 [t] [d] Day24 2023.3.16 周四