问题描述
本题为填空题,只需要算出结果后,在代码中使用输出语句将所填结果输出即可。
已知今天是星期六,请问 20222022 天后是星期几?
注意用数字 1 到 7 表示星期一到星期日。
运行限制
- 最大运行时间:1s
- 最大运行内存: 512M
import java.util.Scanner;
import java.text.*;
import java.math.*;
// 1:无需package
// 2: 类名必须Main, 不可修改
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码...
double sum=(Math.pow(20,22)%7);
BigInteger a=new BigInteger(String.valueOf((int)sum));
BigInteger liu=new BigInteger("6");
BigInteger qi=new BigInteger("7");
BigInteger ans=a.add(liu).remainder(qi);
if(ans.equals(new BigInteger("0"))){
System.out.println(7);
}
else{
System.out.println(ans);
}
}
}
该程序使用Java编写,计算从今天(星期六)开始20222022天后的日期。通过模7运算确定星期,结果以1-7的数字表示。
2532





