首页 > 其他分享 >4-6次题目集总结

4-6次题目集总结

时间:2023-04-29 18:59:11浏览次数:46  
标签:总结 题目 int System month year public day

前言:4-6次pta实验相较于之前三次难度有所提升,主要是为了训练我们对于java类的设计以及类内方法的设计,以及很多语法知识,是正式进入java的过程。

题目集四:

主要知识点是一些语法的使用,类的设计,以及类的方法体,需要考虑输出格式和算法设计,如正则表达式,LinkedHashSet去重等,题目难度不低,有些没学过的语法,需要自己自行学习

7-1 菜单计价程序-3 7-2 有重复的数据 7-3 去掉重复的数据 7-4 单词统计与排序 7-5 面向对象编程(封装性) 7-6 GPS测绘中度分秒转换 7-7 判断两个日期的先后,计算间隔天数、周数

题目集五

主要训练正则表达式的使用,通过慕课的学习,并且参照正则表达式的表格基本能把题目做出,难度不是很大,考虑清楚一些特殊情况即可

 

7-1 正则表达式训练-QQ号校验7-2 字符串训练-字符排序7-3 正则表达式训练-验证码校验7-4 正则表达式训练-学号校验7-5 日期问题面向对象设计(聚合一)7-6 日期问题面向对象设计(聚合二)

   

题目集六

就一道题目菜单类题目,在之前的菜单类上加上了特色菜

菜单类设计

                        题目集四

1.

源码:

心得:着实被这么长的题目吓到,类内方法体不会写,还有主类的输入格式不会设计

2.

 

 源码;

import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int []a=new int[n];
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
}
Arrays.sort(a);
if(n==1)System.out.print("NO");
else{
for(int i=0;i<n-1;i++){
if(a[i]==a[i+1]){
System.out.print("YES");
break;
}
if(i==n-2)System.out.print("NO");
}
}
}
}

心得:先用数组存入数据,然后再去判断重复数据,但是有时间限制,所以要先将数组排序之后在进行判断,要是有Array.sort进行排序,为了防止数组越界,将i=n-2单独拿出来讨论。

3.

源码:


import java.util.*;

public class Main {


public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int []a=new int[n];
for(int i=0;i<n;i++)
a[i]=in.nextInt();
ArrayList<Integer>arr= new ArrayList<>();
for(int i=0;i<n;i++) {
arr.add(a[i]);
}
LinkedHashSet<Integer> arr1= new LinkedHashSet<>(arr);
ArrayList<Integer> arr2=new ArrayList<>(arr1);

for(int i=0;i<arr2.size();i++) {
if(i==arr2.size()-1) System.out.print(arr2.get(i));
else {
System.out.print(arr2.get(i)+" ");
}

}


}

}

 心得:使用集合,将数组中的元素添加到集合中,然后使用linkhashset进行去重,在将去重的数据新存到一个新集合当中,然后在输出新的集合,主要考察linkhashset的使用

 4.

源码:

import java.util.*;

public class Main {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);
String str = scanner.nextLine().replaceAll("[,.]", "");
String[] strr = str.split(" ");
TreeMap<String, Integer> tMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

for (String s : strr) {
tMap.put(s, s.length());

}

List<Map.Entry<String, Integer>> tList = new ArrayList<>(tMap.entrySet());
tList.sort((o1, o2) -> -(o1.getValue() - o2.getValue()));

Iterator<Map.Entry<String, Integer>> iter = tList.iterator();
for(int i=0;i<tList.size();i++) {
Map.Entry<String, Integer> entry = iter.next();
System.out.println(entry.getKey());
}
}
}

 心得:先对输入单词进行处理:使用map接口,单词为键,出现次数为值用内部方法替换掉单词中的特殊符号,根据单词是否重复,从而向写入新的键值对或者增加单词(键)对应的出现次数(值)再对构造的map对象进行类型转换:把键值对看作一个整体,这个整体就是list中元素的具体类型,然后把map变成list,就可以自己写list的比较方法了



5.

源码:

import java.util.Scanner;

public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//调用无参构造方法,并通过setter方法进行设值
String sid1 = sc.next();
String name1 = sc.next();
int age1 = sc.nextInt();
String major1 = sc.next();
Student student1 = new Student();
student1.setSid(sid1);
student1.setName(name1);
student1.setAge(age1);
student1.setMajor(major1);
//调用有参构造方法
String sid2 = sc.next();
String name2 = sc.next();
int age2 = sc.nextInt();
String major2 = sc.next();
Student student2 = new Student(sid2, name2, age2, major2);
//对学生student1和学生student2进行输出
student1.print();
student2.print();
}
}
class Student{
private String sid;
private String name;
private int age;
private String major;
public String getSid() {
return sid;
}

public void setSid(String sid) {
this.sid = sid;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {


this.age = age;
}

public String getMajor() {
return major;
}

public void setMajor(String major) {
this.major = major;
}

public Student(String sid, String name, int age, String major ){
this .sid=sid;
this.name=name;
this.age=age;
this.major=major;

 

}


public Student(){

}
public void print(){
System.out.println("学号:"+getSid()+",姓名:"+getName()+",年龄:"+getAge()+",专业:"+getMajor());

}


}

 心得:题目已经给了主类方法,student类只需要创建成员变量和get/set方法最后调用即可。只需要注意输出格式。

6.

源码:

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
int a=0;double b=0;double c=0;
double d=0;
Scanner in=new Scanner(System.in);
a=in.nextInt();
b=in.nextDouble();
c=in.nextDouble();
d=a+b/60+c/3600;
System.out.print(a+"°"+(int)b+"′"+c+"″ = ");
System.out.printf( "%.6f",d);


}
}

心得:这题是简单的按格式输出,注意将b转化成int类型即可

 7.

源码:

import jdk.jshell.execution.Util;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String a = in.nextLine();
String b = in.nextLine();
String[] str1 = a.split("-");
String[] str2 = b.split("-");
int year1 = Integer.parseInt(str1[0]);
int month1 = Integer.parseInt(str1[1]);
int day1 = Integer.parseInt(str1[2]);
int year2 = Integer.parseInt(str2[0]);
int month2 = Integer.parseInt(str2[1]);
int day2 = Integer.parseInt(str2[2]);
LocalDate of1 = LocalDate.of(year1, month1, day1);
LocalDate of2 = LocalDate.of(year2, month2, day2);
if (of1.isBefore(of2))
System.out.println("第一个日期比第二个日期更早");
else
System.out.println("第一个日期比第二个日期更晚");
int day = (int) of1.until(of2, ChronoUnit.DAYS);
int week = (int) of2.until(of1, ChronoUnit.WEEKS);
System.out.println("两个日期间隔"+Math.abs(day)+"天");
System.out.println("两个日期间隔"+Math.abs(week)+"周");

 

}
}

心得:这题参考API文档了解了这些方法的作用,以及方法的参数,调用使用即可。

                          题目集五

1.

 

 源码:

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Main {

public static void main(String[] args) {
Scanner in =new Scanner(System.in);
String s = in.nextLine();
String reg = "^[1-9][0-9]{4,14}";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(s);
if(matcher.find()&&s.length()<=15) System.out.println("你输入的"+"QQ"+"号验证成功");
else System.out.println("你输入的"+"QQ"+"号验证失败");

}
}

心得:学习正则表达式的输入输出,对字符串进行合理的划分,划分格式还不太熟悉,有待练习

 源码:

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

public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s=in.nextLine();
char[] s1= new char[s.length()];
for(int i=0;i<s.length();i++)
s1[i]=s.charAt(i);
Arrays.sort(s1);
for(int i=0;i<s.length();i++)
System.out.print(s1[i]);


}
}

 心得:用ChatAt提取单个字符存入s1数组中,然后Arraysort对数组进行排序,然后输出即可

 源码:

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s=in.nextLine();
String reg = "[A-Z a-z 0-9]{4}";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(s);
if(matcher.find()&&s.length()==4) System.out.println(matcher.group()+"属于验证码");
else System.out.println(s+"不属于验证码");
}
}

心得:先对输入字符判断,判断是否为四位数,以及是否是A-Z和0-9之间的数,然后通过matcher.find为ture 同时s的length为4判断成立,反之则不属于。

 

 源码:

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.nextLine();
String reg = "2020(1[1-7]|61|7[1-3]|8[1-3])(40|0[1-9]|[1-3][0-9])$";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(s);
if (matcher.find()) System.out.println("正确");
else System.out.println("错误");
}
}

心得:还是正则表达式的使用对学号的每一位进行分析,先前两位  20固定,然后两位在设定的数字里面查找,班级的两位同样,最后两位要考虑0开头的两位以及范围边界值问题。

 

 源码:

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int year = 0;
int month = 0;
int day = 0;

int choice = input.nextInt();

if (choice == 1) { // test getNextNDays method
int m = 0;
year = Integer.parseInt(input.next());
month = Integer.parseInt(input.next());
day = Integer.parseInt(input.next());

DateUtil date = new DateUtil(year, month, day);

if (!date.checkInputValidity( year,month,day)) {
System.out.println("Wrong Format");
System.exit(0);
}

m = input.nextInt();

if (m < 0) {
System.out.println("Wrong Format");
System.exit(0);
}

System.out.println(date.getNextNDays(m).showDate());
} else if (choice == 2) { // test getPreviousNDays method
int n = 0;
year = Integer.parseInt(input.next());
month = Integer.parseInt(input.next());
day = Integer.parseInt(input.next());

DateUtil date = new DateUtil(year, month, day);

if (!date.checkInputValidity( year, month, day)) {
System.out.println("Wrong Format");
System.exit(0);
}

n = input.nextInt();

if (n < 0) {
System.out.println("Wrong Format");
System.exit(0);
}


System.out.println(date.getPreviousNDays(n).showDate());
} else if (choice == 3) { //test getDaysofDates method
year = Integer.parseInt(input.next());
month = Integer.parseInt(input.next());
day = Integer.parseInt(input.next());

int anotherYear = Integer.parseInt(input.next());
int anotherMonth = Integer.parseInt(input.next());
int anotherDay = Integer.parseInt(input.next());

DateUtil fromDate = new DateUtil(year, month, day);
DateUtil toDate = new DateUtil(anotherYear, anotherMonth, anotherDay);

if (fromDate.checkInputValidity( year, month, day) && toDate.checkInputValidity( year, month, day)) {
System.out.println(fromDate.getDaysofDates(toDate));
} else {
System.out.println("Wrong Format");
System.exit(0);
}
}
else{
System.out.println("Wrong Format");
System.exit(0);
}
}
}

class DateUtil {
int year;
int month;
int day;
int[] a = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

DateUtil() {

}

DateUtil(int year, int month, int day) {
this.year = year;
this.month = month;
this.day = day;
}

public int getYear() {
return year;
}

public void setYear(int year) {
this.year = year;
}

public int getMonth() {
return month;
}

public void setMonth(int month) {
this.month = month;
}

public int getDay() {
return day;
}

public void setDay(int day) {
this.day = day;
}

public boolean isLeapYear(int year) {

return (0 == year % 4 && year % 100 != 0) || (0 == year % 400);
}

public boolean checkInputValidity(int year, int month, int day) {

int[] a = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (isLeapYear(year))
a[2] = 29;
return (year >= 1900 && year <= 2050 && month > 0 && month <= 12 && day <= a[month] && day > 0);

}

 

public DateUtil getNextNDays(int n) {
while (n > 365) {
if (this.isLeapYear(year) && month <= 2) {
if (month == 2 && day == 29) {
day = 1;
month = 3;
}
year++;
n = n - 366;
} else if (this.isLeapYear(year + 1) && month > 2) {
year++;
n = n - 366;
} else {
year++;
n = n - 365;
}
}
for (int i = 0; i < n; i++) {
day++;
if (isLeapYear(year) && month == 2) {
if (day > 29) {
month = 3;
day = 1;
}
} else if (day > a[month]) {
month++;
day = 1;
if (month > 12) {
month = 1;
year++;
}

}

}


return this;

}

public DateUtil getPreviousNDays(int n) {

while (n > 365) {
if (isLeapYear(getYear()) && getMonth() > 2) {
n = n - 366;
setYear(getYear() - 1);
} else if (isLeapYear(getYear()) && getMonth() <= 2) {
n = n - 366;
setYear(getYear() - 1);
} else {
n = n - 365;
setYear(getYear() - 1);
}
}
for (int i = 0; i < n; i++) {
setDay(getDay() - 1);
if (getDay() <= 0) {
setMonth(getMonth() - 1);
if (getMonth() <= 0) {
setMonth(12);
setYear(getYear() - 1);
}
if (isLeapYear(getYear()) && month == 2)
setDay(29);
else setDay(a[getMonth()]);
}

}

return this;
}


public boolean compareDates(DateUtil date) {
if (this.year > date.getYear())
return true;
else if (this.year == date.getYear())
if (this.month > date.getMonth())
return true;
else if (this.year == date.getYear() && this.month == date.getMonth() && this.month == date.getMonth())
return this.day == date.getDay();
return false;

}

public boolean equalTwoDates(DateUtil date) {
if (this.year != date.getYear())
return false;
else if (this.month != date.getMonth())
return false;
else return this.day == date.getDay();

}

public int getDaysofDates(DateUtil date) {
int flag=0;
if(this.compareDates(date)){
while (getYear()-date.getYear()>=2){
if(isLeapYear(getYear())&&getMonth()>2)
flag=flag+366;
else flag=flag+365;
setYear(getYear()-1);
}
while (!equalTwoDates(date)) {
flag++;
setDay(getDay() - 1);
if (getDay() <= 0) {
setMonth(getMonth() - 1);
if (getMonth() <= 0) {
setMonth(12);
setYear(getYear() - 1);
}
if (isLeapYear(getYear()) && getMonth() == 2)
setDay(29);
else setDay(a[getMonth()]);
}
}
}
else {
while (date.getYear()-getYear()>=2){
if(isLeapYear(getYear())&&getMonth()<=2)
flag=flag+366;
else if(isLeapYear(getYear()+1)&&getMonth()>2)
flag=flag+366;
else flag=flag+365;
setYear(getYear()+1);
}
while (!equalTwoDates(date)) {
flag++;
setDay(getDay() + 1);
if (isLeapYear(getYear()) && getMonth() == 2) {
if (getDay() > 29) {
setMonth(getMonth() + 1);
setDay(1);
}
} else if (getDay() > a[getMonth()]) {
setMonth(getMonth() + 1);
setDay(1);
if (getMonth() > 12) {
setMonth(1);
setYear(getYear() + 1);
}
}

}

}
return flag;
}

 

public String showDate() {
return year + "-" + month + "-" + day;
}


}

 

 

心得:参考第三次题目集的设计,主要设计求前n天,后n天,两日期相差天数,判读日期是否闰年。

是否是闰年:设置闰年成立的条件即可

前n天:先考虑大于一年的情况,这个时候只需要对年进行加值,当日期小于一年时,在细化月日的加减,二约特殊单独拿出来讨论,将剩余天数做一个循环,判断什么时候月加,什么时候日加,要考虑边界值跨年,月底等情况

后n天:和前天相似

 两日期相差天数:先对两日期进行操作,然后通过是否相等方法判断,同样先判断年,先把年搞成相同的,然后在去判断月和日,让一个日期去减,减到判断相等方法成立,最后输出

 

 源码:

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int year = 0;
int month = 0;
int day = 0;

int choice = input.nextInt();

if (choice == 1) { // test getNextNDays method
int m = 0;
year = Integer.parseInt(input.next());
month = Integer.parseInt(input.next());
day = Integer.parseInt(input.next());

DateUtil date = new DateUtil(year, month, day);

if (!date.checkInputValidity( year,month,day)) {
System.out.println("Wrong Format");
System.exit(0);
}

m = input.nextInt();

if (m < 0) {
System.out.println("Wrong Format");
System.exit(0);
}

System.out.print(date.getYear() + "-" + date.getMonth() + "-" + date.getDay() + " next " + m + " days is:");
System.out.println(date.getNextNDays(m).showDate());
} else if (choice == 2) { // test getPreviousNDays method
int n = 0;
year = Integer.parseInt(input.next());
month = Integer.parseInt(input.next());
day = Integer.parseInt(input.next());

DateUtil date = new DateUtil(year, month, day);

if (!date.checkInputValidity( year, month, day)) {
System.out.println("Wrong Format");
System.exit(0);
}

n = input.nextInt();

if (n < 0) {
System.out.println("Wrong Format");
System.exit(0);
}

System.out.print(
date.getYear() + "-" + date.getMonth() + "-" + date.getDay() + " previous " + n + " days is:");
System.out.println(date.getPreviousNDays(n).showDate());
} else if (choice == 3) { //test getDaysofDates method
year = Integer.parseInt(input.next());
month = Integer.parseInt(input.next());
day = Integer.parseInt(input.next());

int anotherYear = Integer.parseInt(input.next());
int anotherMonth = Integer.parseInt(input.next());
int anotherDay = Integer.parseInt(input.next());

DateUtil fromDate = new DateUtil(year, month, day);
DateUtil toDate = new DateUtil(anotherYear, anotherMonth, anotherDay);

if (fromDate.checkInputValidity( year, month, day) && toDate.checkInputValidity( year, month, day)) {
System.out.println("The days between " + fromDate.showDate() +
" and " + toDate.showDate() + " are:"
+ fromDate.getDaysofDates(toDate));
} else {
System.out.println("Wrong Format");
System.exit(0);
}
}
else{
System.out.println("Wrong Format");
System.exit(0);
}
}
}

class DateUtil {
int year;
int month;
int day;
int[] a = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

DateUtil() {

}

DateUtil(int year, int month, int day) {
this.year = year;
this.month = month;
this.day = day;
}

public int getYear() {
return year;
}

public void setYear(int year) {
this.year = year;
}

public int getMonth() {
return month;
}

public void setMonth(int month) {
this.month = month;
}

public int getDay() {
return day;
}

public void setDay(int day) {
this.day = day;
}

public boolean isLeapYear(int year) {

return (0 == year % 4 && year % 100 != 0) || (0 == year % 400);
}

public boolean checkInputValidity(int year, int month, int day) {

int[] a = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (isLeapYear(year))
a[2] = 29;
return (year >= 1820 && year <= 2020 && month > 0 && month <= 12 && day <= a[month] && day > 0);

}

 

public DateUtil getNextNDays(int n) {
while (n > 365) {
if (this.isLeapYear(year) && month <= 2) {
if (month == 2 && day == 29) {
day = 1;
month = 3;
}
year++;
n = n - 366;
} else if (this.isLeapYear(year + 1) && month > 2) {
year++;
n = n - 366;
} else {
year++;
n = n - 365;
}
}
for (int i = 0; i < n; i++) {
day++;
if (isLeapYear(year) && month == 2) {
if (day > 29) {
month = 3;
day = 1;
}
} else if (day > a[month]) {
month++;
day = 1;
if (month > 12) {
month = 1;
year++;
}

}

}


return this;

}

public DateUtil getPreviousNDays(int n) {

while (n > 365) {
if (isLeapYear(getYear()) && getMonth() > 2) {
n = n - 366;
setYear(getYear() - 1);
} else if (isLeapYear(getYear()) && getMonth() <= 2) {
n = n - 366;
setYear(getYear() - 1);
} else {
n = n - 365;
setYear(getYear() - 1);
}
}
for (int i = 0; i < n; i++) {
setDay(getDay() - 1);
if (getDay() <= 0) {
setMonth(getMonth() - 1);
if (getMonth() <= 0) {
setMonth(12);
setYear(getYear() - 1);
}
if (isLeapYear(getYear()) && month == 2)
setDay(29);
else setDay(a[getMonth()]);
}

}

return this;
}


public boolean compareDates(DateUtil date) {
if (this.year > date.getYear())
return true;
else if (this.year == date.getYear())
if (this.month > date.getMonth())
return true;
else if (this.year == date.getYear() && this.month == date.getMonth() && this.month == date.getMonth())
return this.day == date.getDay();
return false;

}

public boolean equalTwoDates(DateUtil date) {
if (this.year != date.getYear())
return false;
else if (this.month != date.getMonth())
return false;
else return this.day == date.getDay();

}

public int getDaysofDates(DateUtil date) {
int flag=0;
if(this.compareDates(date)){
while (getYear()-date.getYear()>=2){
if(isLeapYear(getYear())&&getMonth()>2)
flag=flag+366;
else flag=flag+365;
setYear(getYear()-1);
}
while (!equalTwoDates(date)) {
flag++;
setDay(getDay() - 1);
if (getDay() <= 0) {
setMonth(getMonth() - 1);
if (getMonth() <= 0) {
setMonth(12);
setYear(getYear() - 1);
}
if (isLeapYear(getYear()) && getMonth() == 2)
setDay(29);
else setDay(a[getMonth()]);
}
}
}
else {
while (date.getYear()-getYear()>=2){
if(isLeapYear(getYear())&&getMonth()<=2)
flag=flag+366;
else if(isLeapYear(getYear()+1)&&getMonth()>2)
flag=flag+366;
else flag=flag+365;
setYear(getYear()+1);
}
while (!equalTwoDates(date)) {
flag++;
setDay(getDay() + 1);
if (isLeapYear(getYear()) && getMonth() == 2) {
if (getDay() > 29) {
setMonth(getMonth() + 1);
setDay(1);
}
} else if (getDay() > a[getMonth()]) {
setMonth(getMonth() + 1);
setDay(1);
if (getMonth() > 12) {
setMonth(1);
setYear(getYear() + 1);
}
}

}

}
return flag;
}

 

public String showDate() {
return year + "-" + month + "-" + day;
}


}

 

 

心得:

参考第三次题目集的设计,主要设计求前n天,后n天,两日期相差天数,判读日期是否闰年。

是否是闰年:设置闰年成立的条件即可

前n天:先考虑大于一年的情况,这个时候只需要对年进行加值,当日期小于一年时,在细化月日的加减,二约特殊单独拿出来讨论,将剩余天数做一个循环,判断什么时候月加,什么时候日加,要考虑边界值跨年,月底等情况

后n天:和前天相似

 两日期相差天数:先对两日期进行操作,然后通过是否相等方法判断,同样先判断年,先把年搞成相同的,然后在去判断月和日,让一个日期去减,减到判断相等方法成立,最后输出

                                  题目集六

 

 心得:畏难情绪,也想了那么久,没有什么思绪,然后就是从众心理,看见别人也做不出来自己也有些动摇了

     

标签:总结,题目,int,System,month,year,public,day
From: https://www.cnblogs.com/zzjw/p/17364348.html

相关文章

  • PTA题目集4~6的总结
    1.前言题目集4题目集4题目量适中,整体难度中偏易题目7-1要求厘清类与类间的关系,能对题目所给的要求作出准确的设计,难度中偏上题目7-2~7-7考察基本的算法,对Java中集合框架的使用以及对LocalDate类的使用,总体上难度偏易题目集5......
  • Java题目集4~6的总结
    1.前言第四次作业主要涉及的知识点有通过查询JavaAPI文档,了解Scanner类中nextLine()等方法、String类中split()等方法、Integer类中parseInt()等方法的用法,了解LocalDate类中of()、isAfter()、isBefore()、until()等方法的使用规则,了解ChronoUnit类中DAYS、WEEKS、MONTHS等单位......
  • Codeforces Round 854 补题总结
    CodeforcesRound854补题总结前言昨天做这套题很不顺,今天补完题大概总结一下。总结RecentActions按题意模拟即可,考虑到前\(n\)个数一定始终在后\(m\)个数的前面,所以说当当前队列中如果没有出现\(x\)而在第\(i\)轮放进了\(x\),那么当前在队首的编号小于\(n\)的数......
  • oo第二次博客总结
      目录1.前言2.设计与分析3.踩坑心得4.改进建议5.总结一:前言题目集四:1,菜单计价程序-32,有重复的数据3,去掉重复的数据4.单词的统计与排序5.面向对象编程(封装性)6.GPS测绘中度分秒转换7.判断两个日期的先后,计算间隔天数、周数.题目集五:1.正则表达式训练-QQ号校......
  • pta第二部分总结oop训练集05-06
    (1)前言训练集05:(题量适中,难度适中)7-5:多个类的互相调用对于日期类的整体优化,聚合初体验。7-6:对7-5的优化,加强聚合训练。训练集06:(题量少,难度大)7-1:多需求的实现。(完成的不好,编程能力还不够)(2)设计与分析7-5:类图: 源码:importjava.util.Scanner;publicclassMain{......
  • 集训总结
    集训总结前言“吹散记忆的蒲公英,散落碧空;回望过往的风景,尤存风味。”离开初中生活,总会幻想回到过去,回到以前的老师同学身边,羞怯而带有稚气。结束了本蒟蒻的第一次NOIP,第一次自己在外地参加集训。内心却也充满无法言表的激动。而今总结半个月的回忆,内心充满了话,却不知从何开......
  • 题目集4-6
     第二次blog作业1.前言作为一个java和面向对象的初学者,在写题目这方面确实是处处碰壁,但学习最重要的是坚持,希望我能够坚持下去。对于这三次的题目集,就难度而言是比较难的,难在一些测试点需要经过深层次的思考,还要通过大量的测试测试出来,必须承认的是考到的一些知识在题目中都有......
  • IPv6地址总结
    一、IPv6特点地址空间更大,地址长度128位,更便于路由汇总;无需NAT;保留单播,组播,新加入的任意播取代广播;二、IPv6地址分类1.单播地址:和IPv4一样单播地址:除FF00::/8之外的全部IPv6地址可以在启用IPv6接口下自动生成(1)链路本地地址(Link-LocalAddress)链路本地地址是自动生成的,链路本地地......
  • 1.3 关于双指针的一些总结
    这篇内容主要是针对双指针的一些总结,方法比较巧妙,主要核心原理就是:有一个快指针fast、一个慢指针slow,slow指针主要作用就是存储真正的数组(也就是处理之后的结果),fast是辅助寻找元素,然后往slow里面放。典型例题:描述:给你一个数组nums 和一个值val,你需要原地移除所有数值等于......
  • PTA题集4-6总结
    一,前言题集四主要考察了arraylist数组的运用,面向对象的封装性,运用数组高效率去重以及运用数组的一些自带方法解决问题,题量较小,除了7-1之外,其它题目难度较低。除此之外,7-6要求我们自主学习Scanner类中nextLine()等方法、String类中split()等方法、Integer类中parseInt()等方法的用......