当前位置:网站首页>【每日一题】第一天
【每日一题】第一天
2022-07-02 17:09:00 【亚太地区百大最帅面孔第101名】
️ Author: 老九
️ 个人博客:老九的CSDN博客
个人名言:不可控之事 乐观面对
系列专栏:每日一题
选择

Character是包装类,不能存放字符串常量,String可以,StringBuffer需要new对象才能使用,Vector是集合

方法的重写:存在继承关系,子类需要的方法父类无法满足, 子类方法重写的权限大小必须要大于父类,其他都一样

结构化程序设计原则:模块化,自顶向下,逐步求精

成员变量没有初始化默认给0

java中求余可以带小数,C语言不行





静态方法才能用类名访问
编程题1

分组方式可以先从小到大排序,然后拿第一个和最后两个凑为一组
公式:arr.len-2*(i+1)
public class test1 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNextInt()) {
int n = scan.nextInt();
int[] array = new int[3 * n];
long sum = 0;
for (int i = 0; i < 3 * n; i++) {
array[i] = scan.nextInt();
}
Arrays.sort(array);
for (int i = 0; i < n; i++) {
sum += array[array.length - 2 * (i + 1)];
}
System.out.println(sum);
}
}
}
编程题2

1.遍历str2这个字符串,把对应的字符放到hash[]
2.遍历str1,找到 == 0的才是要的字符
public class test1 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str1 = scan.nextLine();
String str2 = scan.nextLine();
HashMap<Character,Integer> map = new HashMap();
for(int i = 0;i<str2.length();i++){
if(map.get(str2.charAt(i)) == null){
map.put(str2.charAt(i),1);
}else{
map.put(str2.charAt(i),map.get(str2.charAt(i))+1);
}
}
String ret = "";
for(int i = 0;i< str1.length();i++){
if(map.get(str1.charAt(i)) == null){
ret += str1.charAt(i);
}
}
System.out.println(ret);
}
}
————————————————————————
码字不易,大家的支持就是我坚持下去的动力
版权声明:本文为CSDN博主「亚太地区百大最帅面孔第101名」的原创文章
边栏推荐
- Unity learning shader notes [82] black and white processing of enhanced single channel color rendering
- Matlab中弧度转角度、角度转弧度
- Introduction to sap s/4hana OData mock service
- iptable端口重定向 MASQUERADE[通俗易懂]
- UE4 draw a circle with spline
- Memory mapping of QT
- Esp32-c3 introductory tutorial question ⑪ - ESP tls: create_ ssl_ handle failed, tls_ io_ instance->options. trusted_ certs null
- Qt官方示例:Qt Quick Controls - Gallery
- Three ways of function parameter transfer in C language
- UE4 用spline畫正圓
猜你喜欢
![[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations](/img/15/298ea6f7367741e1e085007c498e51.jpg)
[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations

Wechat applet video sharing platform system graduation design (2) applet function

Wechat applet video sharing platform system graduation design completion (4) opening report

再放寬!這些應届生,可直接落戶上海

【每日一题】第二天

Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用

Another double non reform exam 408, will it be cold? Software College of Nanchang Aviation University

NM01-独立于总线协议的NM模块功能概述与API定义

Pit encountered during installation of laravel frame

The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown
随机推荐
Yesterday, Alibaba senior wrote a responsibility chain model, and there were countless bugs
Qt官方示例:Qt Quick Controls - Gallery
Uncover the whole link communication process of dewu customer service im
Detailed explanation of cjson usage
2020 Internet industry terminology
Wechat applet video sharing platform system graduation design completion (6) opening defense ppt
Leetcode(81)——搜索旋转排序数组 II
揭秘得物客服IM全链路通信过程
Wechat nucleic acid detection appointment applet system graduation design completion (5) task statement
如何清理废弃pv和其对应的文件夹
Is it safe to buy funds on Alipay account
Radian to angle, angle to radian in MATLAB
Esp32-c3 introductory tutorial question ⑩ - error: implicit declaration of function 'ESP_ blufi_ close‘;
@Component 拿不到dao层
paddlepaddle 28 搭建基于卷积的自动编码机
故障排查:kubectl报错ValidationError: unknown field \u00a0
Chrome officially supports MathML, which is enabled in chromium dev 105 by default
Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01
服务器php环境搭建教程,PHP服务端环境搭建图文详解
能解决80%故障的排查思路