选择题的shell,Linux,一脸懵逼,菜狗不会shell,Linux
算法题就挺水的。。。
第二题比较奇淫
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); // get data int N = 998244353; int[] dp = new int[n+1]; dp[0] = 0; dp[1] = 1; dp[2] = 1; dp[3] = 2; for (int i = 4; i <= n; i++){ dp[i] = (dp[i-1] + dp[i-3]) % N; } System.out.println(dp[n]); } }
全部评论
(4) 回帖