当前位置:网站首页>【每日一题】第一天
【每日一题】第一天
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名」的原创文章
边栏推荐
- 任职 22 年,PowerShell 之父将从微软离职:曾因开发 PowerShell 被微软降级过
- 如何清理废弃pv和其对应的文件夹
- 阿里三面被面试官狂问Redis,简历上再也不敢写'精通'了
- Ali was wildly asked by the interviewer on three sides. Redis dared not write 'proficient' on his resume anymore
- iptable端口重定向 MASQUERADE[通俗易懂]
- Paddlepaddle 28 build an automatic coder based on convolution
- Leetcode interview question 17.04 Vanishing numbers
- Redis(6)----对象与数据结构
- 昨天阿里学长写了一个责任链模式,竟然出现了无数个bug
- The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown
猜你喜欢
exness深度好文:动性系列-黄金流动性实例分析(五)
After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
Wechat nucleic acid detection appointment applet system graduation design (2) applet function
Wechat applet video sharing platform system graduation design (3) background function
Pit encountered during installation of laravel frame
Night God simulator +fiddler packet capture test app
300+篇文献!一文详解基于Transformer的多模态学习最新进展
Leetcode interview question 16.17 Continuous sequence
鸿蒙第四次学习
A simple PHP personal card issuing program v4.0
随机推荐
Ue4 dessine un cercle avec une ligne de contour
paddlepaddle 28 搭建基于卷积的自动编码机
Leetcode interview question 17.04 Vanishing numbers
Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用
Wechat applet video sharing platform system graduation design completion (5) assignment
Web版3D可视化工具,程序员应该知道的97件事,AI前沿论文 | 资讯日报 #2022.07.01
Chain game system development (unity3d chain game development details) - chain game development mature technology source code
距离度量 —— 杰卡德距离(Jaccard Distance)
【Oracle 期末复习】表空间、表、约束、索引、视图的增删改
快速排序基本思路(通俗易懂+例子)「建议收藏」
In early summer, Kaiyuan magic changed an electric mosquito racket with killing sound effect!
The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown
Tower safety monitoring system unattended inclination vibration monitoring system
Uncover the whole link communication process of dewu customer service im
Redis (7) -- database and expiration key
Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01
@Component 拿不到dao层
Paddlepaddle 28 build an automatic coder based on convolution
QQmlApplicationEngine
鸿蒙第四次学习