GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaInterview/java/src/BiShi/Test_01_HuaWei_01.java at master · damaohongtu/JavaInterview

Expand file tree

/

Test_01_HuaWei_01.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
81 lines (70 loc) · 2.11 KB
/

Test_01_HuaWei_01.java

Copy path

File metadata and controls

81 lines (70 loc) · 2.11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package BiShi;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
/**
* @Classname Test_01_HuaWei_01
* @Description TODO
* @Date 19-4-3 下午5:04
* @Created by mao<[email protected]>
*/
public class Test_01_HuaWei_01 {
public static void main(String[] args)throws IOException {
// Scanner sc2=new Scanner(System.in);
Scanner sc2=new Scanner(new File("/home/mao/workspace/java/src/ProgrammingTest/test"));
int len=0;
int flag=0;
ArrayList<String> s=new ArrayList<>();
while(sc2.hasNextLine()){
String tmp=sc2.nextLine();
if(tmp.isEmpty()){
break;
}
if(flag==0){
len=Integer.parseInt(tmp);
flag=1;
}else{
s.add(tmp);
}
}
if(len==0){
return;
}
ArrayList<ArrayList<Integer>> nums=new ArrayList<>();
for(int i=0;i<s.size();i++){
String[] ss=s.get(i).split(",");
ArrayList<Integer> num=new ArrayList<>();
for (String sss:ss){
num.add(Integer.parseInt(sss));
}
nums.add(num);
}
if(nums.size()==0){
return;
}
ArrayList<Integer> outcome=new ArrayList<>();
while(nums.size()!=0){
for(int k=0;k<nums.size();k++){
int a=nums.get(k).size();
if(a==0){
nums.remove(k);
} else if(a>=len){
for(int n=0;n<len;n++){
outcome.add(nums.get(k).get(0));
nums.get(k).remove(0);
}
}else{
for(int n=0;n<a;n++){
outcome.add(nums.get(k).get(0));
nums.get(k).remove(0);
}
}
}
}
for(int l=0;l<outcome.size()-1;l++){
System.out.print(outcome.get(l)+",");
}
System.out.print(outcome.get(outcome.size()-1));
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.