自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(36)
  • 收藏
  • 关注

原创 //顺时针打印矩阵

import java.util.*;//顺时针打印矩阵public class Main_252 { public int[] clockwisePrint(int[][] mat, int n, int m) { int x1=0,y1=0; int x2=n-1,y2=m-1; int i,j; int len=n*m; int arr[]=new int[len]; int flag=1;.

2020-07-27 10:04:51 109

原创 //左右最值最大差

import java.util.Arrays;//左右最值最大差public class Main_251 { public static int findMaxGap(int[] A, int n) { // write code here int[] max = new int[n - 1]; int k = 0; int max1 = 0; int max2 = 0; for (int i .

2020-07-27 10:04:18 173

原创 //查找兄弟单词

import java.util.*;//查找兄弟单词public class Main_222 { private static boolean isBrother(String str1, String str2){ char[] chars1 = str1.toCharArray(); char[] chars2 = str2.toCharArray(); Arrays.sort(chars1); Arrays.sort.

2020-07-24 11:07:21 126

原创 //乒乓球筐

import java.util.HashMap;import java.util.Scanner;//乒乓球筐public class Main_221 { // write your code here public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String s = .

2020-07-24 11:06:49 154

原创 //单词倒排

import java.util.Scanner;//单词倒排public class Main_212 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String in = sc.nextLine(); String[] words = in.split.

2020-07-23 10:44:03 183

原创 //骆驼命名法

import java.util.Scanner;//骆驼命名法public class Main_211 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String typeC = sc.next(); String typeJ = ""; .

2020-07-23 10:43:21 137

原创 求和

//求和import java.util.*;public class Main_202 { static ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>(); static ArrayList<Integer> list = new ArrayList<>(); public static void main.

2020-07-21 17:31:05 112

原创 电话号码

import java.util.ArrayList;import java.util.Collections;import java.util.Scanner;//电话号码public class Main_201 { public static void main(String[] args) { String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; String num = "222333444555.

2020-07-21 17:30:35 215

原创 //单调栈结构

import java.util.*;//单调栈结构public class Main_142 { public static int[][] getNearLessRepeat(int[] arr) { ArrayDeque<List<Integer>> stack = new ArrayDeque<>(); int[][] res = new int[arr.length][2]; for (int i =.

2020-07-18 10:12:44 128

原创 数组中值出现了一次的数字

import java.util.Arrays;import java.util.Scanner;//数组中值出现了一次的数字public class Main_141 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int num = scanner.nex.

2020-07-18 10:08:33 103

原创 句子逆序

import java.util.Scanner;//句子逆序public class Main_132 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String sentence = scanner.nextLine(); Str.

2020-07-18 10:06:46 103

原创 删除公共字符

import java.util.Scanner;//删除公共字符public class Main_131 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String s1 = scanner.nextLine(); String s.

2020-07-18 10:06:03 94

原创 TcpThreadPoolEchoServer

import java.io.*;import java.net.ServerSocket;import java.net.Socket;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;public class TcpThreadPoolEchoServer { private ServerSocket serverSocket = null; public T.

2020-07-16 18:48:13 135

原创 TcpThreadEchoServer

import java.io.*;import java.net.ServerSocket;import java.net.Socket;public class TcpThreadEchoServer { private ServerSocket serverSocket = null; public TcpThreadEchoServer (int port) throws IOException { serverSocket = new ServerSock.

2020-07-16 18:47:14 129

原创 TcpEchoServer

import java.io.*;import java.net.ServerSocket;import java.net.Socket;public class TcpEchoServer { // 1. 初始化服务器 // 2. 进入主循环 // 1) 先去从内核中获取到一个 TCP 的连接 // 2) 处理这个 TCP 的连接 // a) 读取请求并解析 // b) 根据请求计算响应 // c) 把响应写.

2020-07-16 18:46:42 314

原创 TcpEchoClient

import java.io.*;import java.net.Socket;import java.util.Scanner;public class TcpEchoClient { // 1. 启动客户端(一定不要绑定端口号) 和服务器建立连接 // 2. 进入主循环 // a) 读取用户输入内容 // b) 构造一个请求发送给服务器 // c) 读取服务器的响应数据 // d) 把响应数据显示到界面上. private Soc.

2020-07-16 18:46:10 460

原创 最近公共祖先

//最近公共祖先public class Main_121 { public int getLCA(int a, int b) { if (a == b || a == b/2) { return a; } if (a/2 == b) { return b; } while (a != b) { if (a > b) { .

2020-07-16 18:44:49 133

原创 空格替换

import java.util.Arrays;//空格替换public class Main_122 { public String replaceSpace(String iniString, int length) { String ne = ""; int count = 0; String[] a = iniString.split(" "); for (int i = 0; i < a.length; i++) .

2020-07-16 18:44:26 105

原创 地下

import java.util.Scanner;//地下迷宫public class Main_112 { public static String path = ""; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int .

2020-07-15 18:42:38 124

原创 木棒拼图

import java.util.Arrays;import java.util.Scanner;//木棒拼图public class Main_111 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int num = scanner.nextInt();.

2020-07-15 18:41:49 214

原创 进制转换

import java.util.Scanner;//进制转换public class Main_102 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String str = scanner.next(); char[] ch = s.

2020-07-13 18:32:19 187

原创 字母统计

import java.util.Scanner;//字母统计//对每个案例按A-Z的顺序输出其中大写字母出现的次数public class Main_101 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String in = scanner.nextLi.

2020-07-13 18:31:49 177

原创 球的半径和体积

import java.util.Scanner;//球的半径和体积public class Main_082 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int[] dian = new int[6]; for (int i = 0.

2020-07-10 20:22:18 143

原创 Broken KeyBoard

import java.util.LinkedHashMap;import java.util.Map;import java.util.Scanner;//Broken KeyBoardpublic class Main_081 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { .

2020-07-10 20:21:46 347

原创 上楼梯

public class Main_072 {//上楼梯 public int countWays(int n){ int a = 1,b = 2,c = 4; if (n== 1){ return a; }else if (n == 2){ return b; }else if (n == 3){ .

2020-07-10 19:02:46 97

原创 锤子剪刀布

import java.util.Scanner;//锤子剪刀布public class Main_071 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); //甲乙两人,以甲为记录,甲胜即乙负; int win = 0; int lose = 0; int equ = 0; in.

2020-07-10 19:02:11 121

原创 练习UdpEchoClient

import java.io.IOException;import java.net.*;import java.util.Scanner;public class UdpEchoClient { // 客户端的主要流程分成四步. // 1. 从用户这里读取输入的数据. // 2. 构造请求发送给服务器 // 3. 从服务器读取响应 // 4. 把响应写回给客户端. private DatagramSocket socket = null; .

2020-07-09 19:48:40 359

原创 练习UDPEchoServer1

import java.io.IOException;import java.net.DatagramPacket;import java.net.DatagramSocket;import java.net.SocketException;public class UDPEchoServer1 { // 对于一个服务器程序来说, 核心流程也是要分成两步. // 1. 进行初始化操作 (实例化 Socket 对象) // 2. 进入主循环, 接受并处理请求. (主循环就是.

2020-07-09 19:48:02 147

原创 2

public class Main_062{ //2的个数 public int getTwoNum(int n) { int count = 0; int low = 0; int current = 0; int high = 0; int flag = 1; while (n / flag != 0) { .

2020-07-08 22:51:39 124

原创 在霍格沃茨找零钱

import java.util.Scanner;//在霍格沃茨找零钱public class Main_061 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String should = scanner.next(); String.

2020-07-08 22:51:08 122

原创 IO学习2

import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;//字节流粘贴复制public class IO2 { public static void main(String[] args) throws IOException { //copyFile 有泄露危险bug copyFile("E:\\code\\IO练习/view.jp.

2020-07-03 19:55:28 88

原创 验证守形数

import java.util.Scanner;//验证守形数public class Main_011 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int num = scanner.nextInt(); //要判断的数 num.

2020-07-02 18:28:30 293

原创 练习(IO)

import java.io.File;import java.io.IOException;public class IO1 { public static void main(String[] args) throws IOException {// File file = new File("E:\\code\\IO练习\\4");// System.out.println("是否存在 " + file.exists());// Syst.

2020-07-02 18:27:27 87

原创 ip地址转换

import java.util.Scanner;//public class Main_302{// public static void main(String[] args){// Scanner sc = new Scanner(System.in);// String s="";// while(sc.hasNext()){// s = sc.next();//输入IP地址,10.0.3.193//// .

2020-07-01 21:46:24 878

原创 找X

import java.util.Scanner;//找xpublic class Main_301 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int num = scanner.nextInt(); int[] arr = new.

2020-07-01 21:44:26 116

原创 各种转换

public class Main_262 { public static void main(String[] args) { //十进制数转换为二进制数的字符串形式 s = Integer.toBinaryString(num) int num = 100000; String numS = Integer.toBinaryString(num); System.out.println(numS.toString());..

2020-07-01 21:39:53 150

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除