当前位置:网站首页>[daily question] first day
[daily question] first day
2022-07-02 18:50:00 【No. 101 of the top 100 most handsome faces in the Asia Pacific 】
️ Author: intellectuals
️ Personal blog : Old nine CSDN Blog
Personal famous saying : Uncontrollable things Optimistic face
Series column : A daily topic
List of articles
choice
Character Is a wrapper class , Cannot store string constants ,String Sure ,StringBuffer need new Objects can only be used ,Vector Is a collection
Method rewrite : There is an inheritance relationship , The method parent class required by the subclass cannot meet , The permission size of subclass method override must be greater than that of the parent class , Everything else is the same
Principles of structured programming : modularization , The top-down , Progressive refinement
The member variable is not initialized and defaults to 0
java The remainder can take decimals ,C Language doesn't work
Only static methods can be accessed with class names
Programming questions 1
The grouping method can be sorted from small to large , Then take the first and last two to form a group
The formula :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);
}
}
}
Programming questions 2
1. Traverse str2 This string , Put the corresponding characters in hash[]
2. Traverse str1, find == 0 Is the character you want
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);
}
}
————————————————————————
It's not easy to code words , Everyone's support is my driving force to stick to it
Copyright notice : This paper is about CSDN Blogger 「 The top 100 most handsome faces in the Asia Pacific region 101 name 」 The original article of
边栏推荐
- What are the links of the problem
- 产品经理应具备的能力
- Meta universe chain game system development (logic development) - chain game system development (detailed analysis)
- MySQL 关于 only_full_group_by 限制
- A simple PHP personal card issuing program v4.0
- 故障排查:kubectl报错ValidationError: unknown field \u00a0
- 元宇宙链游系统开发(逻辑开发)丨链游系统开发(详细分析)
- C语言中函数参数传递的三种方式
- 问题包含哪些环节
- 学生抖音宣传母校被吐槽“招生减章”,网友:哈哈哈哈哈哈
猜你喜欢
Simulateur nightGod + application de test de capture de paquets Fiddler
exness深度好文:动性系列-黄金流动性实例分析(五)
文字编辑器 希望有错误的句子用红色标红,文字编辑器用了markdown
Esp32-c3 introductory tutorial question ⑩ - error: implicit declaration of function 'ESP_ blufi_ close‘;
学生抖音宣传母校被吐槽“招生减章”,网友:哈哈哈哈哈哈
[Yugong series] July 2022 go teaching course 001 introduction to go language premise
再放寬!這些應届生,可直接落戶上海
Leetcode 面试题 16.17. 连续数列
在纽约寻找童真——新泽西州乐高乐园探索中心的美好一天
深度学习数学基础
随机推荐
Unity learning shader notes [81] simple color adjustment post-processing (brightness, saturation, contrast)
Is it safe to buy funds on Alipay account
Leetcode(81)——搜索旋转排序数组 II
LightGroupButton* sender = static_ cast<LightGroupButton*>(QObject::sender());
CDN acceleration and breaking J anti-theft chain function
Ue4 dessine un cercle avec une ligne de contour
How to clean up discarded PVs and their corresponding folders
Leetcode (81) -- search rotation sort array II
Unity learning shader notes [82] black and white processing of enhanced single channel color rendering
Typical application of "stack" - expression evaluation (implemented in C language)
300+ documents! This article explains the latest progress of multimodal learning based on transformer
Paddlepaddle 28 build an automatic coder based on convolution
Leetcode 面试题 16.17. 连续数列
A simple PHP personal card issuing program v4.0
iptable端口重定向 MASQUERADE[通俗易懂]
Stretchdibits function
夜神模擬器+Fiddler抓包測試App
Stratégie touristique d'été de Singapour: un jour pour visiter l'île de San taosha à Singapour
Iframe nesting details
[Yugong series] July 2022 go teaching course 001 introduction to go language premise