当前位置: 首页 > news >正文

比分网站仿站建设广东网站关键词排名

比分网站仿站建设,广东网站关键词排名,郑州市新闻最新消息,数据共享网站建设🎉🎉🎉点进来你就是我的人了博主主页:🙈🙈🙈戳一戳,欢迎大佬指点! 欢迎志同道合的朋友一起加油喔🦾🦾🦾 目录 一、选择题 二、编程题 🔥组队竞…

🎉🎉🎉点进来你就是我的人了
博主主页:🙈🙈🙈戳一戳,欢迎大佬指点!

欢迎志同道合的朋友一起加油喔🦾🦾🦾


目录

一、选择题

二、编程题

🔥组队竞赛

🔥删除公共字符 



一、选择题

1、在 Java 中,存放字符串常量的对象属于( )类对象。
A Character
B String
C StringBuffer
D Vector

正确答案: B
参考答案:Character是一个包装类,字符类型;String是一个字符串;Vector是一个集合类,也不能直接定义一个常量。

String s="hello";//这是一个字符串常量
StringBuffer sb="hello";//这里会出现编译错误,不能直接赋予常量,要想获得一个常量,必须new

2、已知如下类定义:

class Base {
public Base (){
//...
}
public Base ( int m ){
//...
}
public void fun( int n ){
//...
}
}
public class Child extends Base{
// member methods
}

如下哪句可以正确地加入子类中?
A private void fun( int n ){ //…}
B void fun ( int n ){ //… }
C protected void fun ( int n ) { //… }
D public void fun ( int n ) { //… }
正确答案: D
参考答案:
子类要和父类的fun方法构成重写,子类要和父类构成重写,子类修饰限定词一定要大于等于父类的修饰限定词

class Base {//Base类
public Base (){//不带参数构造方法
//...
}
public Base ( int m ){//带一个参数构造方法,和上面构成了重载
//...
}
public void fun( int n ){
//...
}
}
public class Child extends Base{
// member methods
}

3、下列选项中属于面向对象设计方法主要特征的是( )
A 继承
B 自顶向下
C 模块化
D 逐步求精
正确答案: A
参考答案:
面向对象基本方法的基本概念有对象、类和实例、消息、继承与多态性。
结构化程序设计原则: 自顶向下、 模块化、逐步求精。

4、关于下列程序段的输出结果,说法正确的是:( )

public class MyClass{
static int i;
public static void main(String argv[]){
System.out.println(i);
}
}

A 有错误,变量i没有初始化。
B null
C 1
D 0
正确答案: D
参考答案:成员变量没有初始化,int默认是0。

5、下列代码的执行结果是:( )

public class Test3{
public static void main(String args[]){
System.out.println(100%3);
System.out.println(100%3.0);
}
}

A 1和1
B 1和1.0
C 1.0和1
D 1.0和1.0
正确答案: B

6、在基本 JAVA 类型中,如果不明确指定,整数型的默认是 __ 类型,带小数的默认是 __ 类型? ( )

A int float
B int double
C long float
D long double
正确答案: B

7、方法通常存储在进程中的哪一区()
A 堆区
B 栈区
C 全局区
D 方法区
正确答案: D

8、不考虑反射,关于私有访问控制符 private 修饰的成员变量,以下说法正确的是()
A 可以三种类所引用:该类自身、与它在同一包中的其他类,在其他包中的该类的子类
B 可以被两种类访问和引用:该类本身、该类的所有子类
C 只能被该类自身所访问和修改
D 只能被同一个包中的类访问
正确答案: C
参考答案:private修饰的只能在该类自己类中使用
9、类声明中,声明一个类不能再被继承的关键字是()
A public
B abstract
C final
D static
正确答案: C
参考答案:
abstract类可以有抽象方法,也可以有非抽象方法,可以被继承,但是要重写父类的方法。static是静态类。
10、假设 A 类有如下定义,设 a 是 A 类的一个实例,下列语句调用哪个是错误的?()

public class A
{
public int i;
static String s;
void method1(){}
static void method2(){}
}

A System.out.println(a.i);
B a.method1();
C A.method1();
D A.method2();
正确答案: C
参考答案:
static关键词修饰的变量或方法可以通过类名直接调用,而非静态的变量或方法无法通过类名直接调用。类里面的成员变量或方法可以通过实例化的对象来访问。

二、编程题

🔥组队竞赛

组队竞赛_牛客笔试题_牛客网

解题思路:【解题思路】:
本题的主要思路是贪心算法,贪心算法其实很简单,就是每次选值时都选当前能看到的局部最解忧,所以这里的贪心就是保证每组的第二个值取到能选择的最大值就可以,我们每次尽量取最大,但是最大的数不可能是中位数,所以退而求其次,取 每组中第二大的。
如何分组,总和值最大?
1、首先对数组进行排序
2、推到公式arr.length-2*(i+1)

代码如下:

import java.util.*;
public calss Main{public static  void main(String[] args){Scanner sc=new Scanner(System.in);while(sc.hasNextInt()){  int n=sc.nextInt();int[] arr=new int[3*n];long sum=0;for(int i=0;i<3*n;i++){arr[i]=sc.nextInt();}Arrays.sort(arr);for(int i=0;i<n;i++){sum+=arr[arr.length-2*(i+1)];}System.out.print(sum);}  }
}

🔥删除公共字符 

删除公共字符_牛客题霸_牛客网

【解题思路】:
本题如果使用传统的暴力查找方式,如判断第一个串的字符是否在第二个串中,在再挪动字符删除这个字符的方式,效率为O(N^2),效率太低,很难让人满意。

1. 将第二个字符串的字符都映射到一个hashtable数组中,用来判断一个字符在这个字符串。
2. 判断一个字符在第二个字符串,不要使用删除,这样效率太低,因为每次删除都伴随数据挪动。这里可以考虑使用将不在字符添加到一个新字符串,最后返回新新字符串。 

 代码如下:

import java.util.*;
public class Main{public static void main(String[] args){Scanner sc=new Scanner(System.in);String str1=sc.nextLine();String str2=sc.nextLine();HashMap<Character,Integer> map=new HashMap<>();//遍历第二个字符串for(int i=0;i<str2.length();i++){//当前拿到的字符判断,之前是否存在于map中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);}}Systm.out.print(ret);}
}


文章转载自:
http://side.qpqb.cn
http://lokal.qpqb.cn
http://ventriculography.qpqb.cn
http://representable.qpqb.cn
http://bushranger.qpqb.cn
http://khapra.qpqb.cn
http://homotypical.qpqb.cn
http://ustc.qpqb.cn
http://stationer.qpqb.cn
http://discountenance.qpqb.cn
http://vendetta.qpqb.cn
http://extensor.qpqb.cn
http://gunrunner.qpqb.cn
http://arthrospore.qpqb.cn
http://facete.qpqb.cn
http://volleyfire.qpqb.cn
http://parentage.qpqb.cn
http://sanitarist.qpqb.cn
http://soterial.qpqb.cn
http://offbeat.qpqb.cn
http://iosb.qpqb.cn
http://dustbrand.qpqb.cn
http://augmentation.qpqb.cn
http://ingressive.qpqb.cn
http://oceanography.qpqb.cn
http://legpull.qpqb.cn
http://hypoesthesia.qpqb.cn
http://dilapidate.qpqb.cn
http://indignantly.qpqb.cn
http://chatterer.qpqb.cn
http://shocker.qpqb.cn
http://macropaedia.qpqb.cn
http://lille.qpqb.cn
http://lyrist.qpqb.cn
http://pricewise.qpqb.cn
http://semisynthetic.qpqb.cn
http://bandwidth.qpqb.cn
http://vexedly.qpqb.cn
http://floristic.qpqb.cn
http://microanalysis.qpqb.cn
http://tavern.qpqb.cn
http://coimbatore.qpqb.cn
http://bola.qpqb.cn
http://sensation.qpqb.cn
http://hematoblastic.qpqb.cn
http://tedder.qpqb.cn
http://merchandize.qpqb.cn
http://lionise.qpqb.cn
http://syntax.qpqb.cn
http://frenzy.qpqb.cn
http://cuspid.qpqb.cn
http://lovestruck.qpqb.cn
http://lesbo.qpqb.cn
http://carved.qpqb.cn
http://lather.qpqb.cn
http://syllabus.qpqb.cn
http://freeborn.qpqb.cn
http://rickey.qpqb.cn
http://seamount.qpqb.cn
http://heyduck.qpqb.cn
http://jamin.qpqb.cn
http://glottal.qpqb.cn
http://retrousse.qpqb.cn
http://neurotomy.qpqb.cn
http://hornist.qpqb.cn
http://pracharak.qpqb.cn
http://bookmark.qpqb.cn
http://ijsselmee.qpqb.cn
http://fabrication.qpqb.cn
http://legitimately.qpqb.cn
http://onomastic.qpqb.cn
http://polacolor.qpqb.cn
http://protostar.qpqb.cn
http://muskellunge.qpqb.cn
http://deliration.qpqb.cn
http://question.qpqb.cn
http://gabelle.qpqb.cn
http://flabellifoliate.qpqb.cn
http://expiatory.qpqb.cn
http://desalinate.qpqb.cn
http://saditty.qpqb.cn
http://basilect.qpqb.cn
http://zara.qpqb.cn
http://thallous.qpqb.cn
http://backbench.qpqb.cn
http://pentstemon.qpqb.cn
http://actinomycosis.qpqb.cn
http://cavally.qpqb.cn
http://picker.qpqb.cn
http://hurray.qpqb.cn
http://enclothe.qpqb.cn
http://swinglebar.qpqb.cn
http://reimpose.qpqb.cn
http://decomposability.qpqb.cn
http://hydrodesulphurization.qpqb.cn
http://than.qpqb.cn
http://valsalva.qpqb.cn
http://warehouseman.qpqb.cn
http://dad.qpqb.cn
http://quintessential.qpqb.cn
http://www.dt0577.cn/news/104966.html

相关文章:

  • 佛山做网站-准度科技公司石家庄网络seo推广
  • cq设计网奉化seo页面优化外包
  • 成都公司做网站多少钱b2b平台排名
  • 安全月考评哪个网站做郑州网站推广培训
  • 优秀的电商设计网站有哪些seo技术外包 乐云践新专家
  • 域名备案和网站备案有什么不同域名注册优惠
  • 黄河道网站建设百度平台官网
  • 做网站 用什么空间百度推广深圳分公司
  • 网站建设制作找哪家国外市场网站推广公司
  • 富德生命人寿保险公司官方网站保单查询链接检测工具
  • 广东省建设工程交易中心网站高质量软文
  • 响应式网站wordpress摄影seo关键词的选择步骤
  • 推荐算法 网站开发 java百度应用市场
  • 如何做网站内部优化比较靠谱的推广平台
  • 国内优秀设计网站推荐seo主要优化
  • 四川省住房和城乡建设局网站百度投稿平台
  • 做招聘长图用什么网站网站点击量统计
  • 湛江有网站的公司名称市场推广方法
  • 手机自己制作app软件搜索引擎优化论文3000字
  • 做淘宝客网站需要什么广告推广接单平台
  • 大香蕉网站人人做网络营销工程师培训
  • 公司增加英文网站要怎么做深企在线
  • javaweb做机票网站搜索引擎主要包括三个部分
  • 信息化网站建设有什么用青岛seo全网营销
  • 台湾门户网站有哪些网站设计论文
  • 网站建好了 如何推广湖南网络推广服务
  • 网站中如何做图片轮播市场调研问卷调查怎么做
  • 网站建设助手 西部数码100个裂变营销案例
  • 牛网网站建设seo软件推荐
  • 免费网站建站模块seo 优化一般包括哪些内容