当前位置:网站首页>【每日一题】第一天
【每日一题】第一天
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名」的原创文章
边栏推荐
- How to use PS to extract image color and analyze color matching
- The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown
- 在支付宝账户上买基金安全吗
- Qt Official examples: Qt Quick Controls - Gallery
- Rte11 interrupt decoupling function
- 能解决80%故障的排查思路
- Relax again! These fresh students can settle directly in Shanghai
- Leetcode interview question 16.17 Continuous sequence
- Wechat applet video sharing platform system graduation design completion (4) opening report
- Is it safe to buy funds on Alipay account
猜你喜欢

昨天阿里学长写了一个责任链模式,竟然出现了无数个bug

Leetcode interview question 16.17 Continuous sequence

Détends - toi encore! Ces nouveaux étudiants peuvent s'installer directement à Shanghai

Troubleshooting ideas that can solve 80% of faults

又一所双非改考408,会爆冷么?南昌航空大学软件学院

RDK simulation experiment

夜神模拟器+Fiddler抓包测试App

Simulateur nightGod + application de test de capture de paquets Fiddler

Pit encountered during installation of laravel frame

Uncover the whole link communication process of dewu customer service im
随机推荐
Esp32-c3 introductory tutorial question ⑩ - error: implicit declaration of function 'ESP_ blufi_ close‘;
Deep neural network Summary
Basic idea of quick sorting (easy to understand + examples) "suggestions collection"
Installation tutorial and simple call of Matplotlib
Nm02 nm module call sequence diagram and code interpretation independent of bus protocol
Wechat applet video sharing platform system graduation design (3) background function
300+ documents! This article explains the latest progress of multimodal learning based on transformer
Pit encountered during installation of laravel frame
Simulateur nightGod + application de test de capture de paquets Fiddler
Wechat applet video sharing platform system graduation design completion (8) graduation design thesis template
Wechat applet video sharing platform system graduation design completion (5) assignment
PR曲线和ROC曲线概念及其区别
Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用
RDK simulation experiment
Rte11 interrupt decoupling function
What is cloud primordial? This time, I can finally understand!
Wechat nucleic acid detection appointment applet system graduation design completion (5) task statement
什么是云原生?这回终于能搞明白了!
CDN acceleration and breaking J anti-theft chain function
再放宽!这些应届生,可直接落户上海