The real questions and analysis of the Blue Bridge Cup over the years .
content:
-
- The real questions and analysis of the Blue Bridge Cup over the years.
-
- A: ASC (Difficulty: ★)
- B: Card (Difficulty: ★★)
- C: Straight line (Difficulty: ★★★)
- D: Arrangement of goods (difficulty: ★★)
- E: Path (Difficulty: ★★★★)
- F: Time display (difficulty: ★)
- G: Minimum weight (difficulty: ★★★)
- H: Yang Hui Triangle (Difficulty: ★★★★)
- I: Two-way sorting (difficulty: ★★★★★)
- J: Bracket Sequence (Difficulty: ★★★★★)
A: ASC (Difficulty: ★)
topic:
analyze:
I feel like this question is humiliating me (manual dog head
76
Code:
public class AASC {
public static void main(String[] args) {
System.out.println((int)'L');
}
}
B: Card (Difficulty: ★★)
topic:
analyze:
You can enumerate from 1 onwards.
3181
Code:
public class B卡片 {
public static int arr[]=new int[10];
public static boolean del(int x){
while(x!=0){
arr[x%10]--;
if(arr[x%10]<0)return false;
x/=10;
}
return true;
}
public static void main(String[] args) {
for(int i=0;i<10;i++)arr[i]=2021;
for(int i=1;i<5000;i++){
if(!del(i)){
System.out.println(i-1);
break;
}
}
}
}
C: Straight line (Difficulty: ★★★)
topic:
analyze:
Use: y=kx+b, as a straight line expression.
Once k and b are determined, the straight line is determined. All statistics can be deduplicated.
40257
Code:
D: Arrangement of goods (difficulty: ★★)
topic:
analyze:
Enumerate the divisors of 2021041820210418, and perform multiple loop enumerations on the divisors.
Arrange all three numbers enumerated. to get the answer.
2430
Code:
E: Path (Difficulty: ★★★★)
topic:
analyze:
DP idea, starting from 2 to 2021, each position comes from the previous 21 positions, and
the minimum value of the 21 data can be calculated.
10266837
Code:
F: Time display (difficulty: ★)
topic:
analyze:
The simulation process can be done according to the title.
Code:
import java.util.Scanner;
public class F时间显示 {
public static String tos(long x){
if(x<10)return "0"+x;
else return ""+x;
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
n%=(1000*60*60*24);
n/=1000;
System.out.println(tos(n/3600)+":"+tos((n/60)%60)+":"+tos(n%60));
}
}
G: Minimum weight (difficulty: ★★★)
topic:
analyze:
Manual enumeration finds that it conforms to the ternary rule, so direct ternary calculation can be done.
Code:
import java.util.Scanner;
public class G最少砝码 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long x=sc.nextLong();
long sum=1,cur=1;
while(sum<x){
sum+=Math.pow(3, cur);
cur++;
}
System.out.println(cur);
}
}
H: Yang Hui Triangle (Difficulty: ★★★★)
topic:
analyze:
Violent enumeration to deceive points?
Code:
I: Two-way sorting (difficulty: ★★★★★)
topic:
analyze:
Violent CMP?