# 打卡打卡打卡——今天有认真做题

``````package month_training;

import java.util.Arrays;

public class 数的分解 {
static int[] a = new int[2020];
static int[][] b= new int[10000000][3];
public static void main(String[] args) {
for(int i=1;i<=2019;i++) {
a[i] = i;
}
int count = 0;
for(int i=1;i<=1000;i++) {
for(int j = i+1;j<=1019;j++) {
int k = 2019 - i - j;
if(k>j&&!(String.valueOf(i)+String.valueOf(j)+String.valueOf(k)).contains("2")&&!(String.valueOf(i)+String.valueOf(j)+String.valueOf(k)).contains("4")) {
//b[count][0] = i;
//b[count][1] = j;
//b[count][2] = 2019-i-j;
count++;
}

}
}
System.out.print(count);
}

}
``````

``````package month_training;

public class 猜年龄 {
public static void main(String[] args) {
int tmp = 600;
int ans = 0;
for(int i = 1900;i<=2010;i++) {
for(int j = 1;j<=30;j++) {
//System.out.print(1);
ans = i*10000 + tmp +j;
if(ans%2012 == 0 && ans%3 == 0 && ans%12 == 0)
{
System.out.println(ans);
}
//System.out.print(ans);
}
}
}

}
``````

``````package month_training;

import java.util.Scanner;

public class 成绩分析 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a= 0;
int b = 0;
int c = 0;
for(int i=0;i<n;i++) {
int tmp = sc.nextInt();
if(tmp >=60) {
a++;
System.out.println(1);
}
if(tmp >= 85) {
b++;
System.out.println(-1);
}
}
System.out.println(Math.round(a*100/(n*1.0))+"%");
System.out.println(Math.round(b*100/(n*1.0))+"%");
}

}``````

dp问题，然后涉及到最小质因子，其实我现在看不太懂质因子为啥那么算了....但是孩子会背

``````import java.util.Arrays;
import java.util.Scanner;

public class 最大和 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
//init(n);
int[] val = new int[n+10];
int[] dp = new int[n+10];
for(int i=0;i<n;i++) {
val[i+1] = sc.nextInt();
dp[i+1] = val[i+1];
//System.out.print(get(i));
}
for(int i=1;i<=n;i++) {
dp[i] = Integer.MIN_VALUE;
}
dp[1] = val[1];
for(int i=1;i<=n;i++) {
for(int j =1;j<=get(n-i);j++) {
dp[i+j] = Math.max(dp[i]+val[i+j], dp[i+j]);
}
}
System.out.println(dp[n]);

}

static int get(int n) {
int ans = 0;
int a = n;
if(a == 1) {
return 1;
}
else {
for(int i = 2 ;i<=a/i;i++) {
if(a%i == 0) {
return i;
}
}
}
return n;
}
}``````

...全文
17 回复 打赏 收藏 转发到动态 举报

50,779

• 近7日
• 近30日
• 至今

刷题！