| |

VerySource

 Forgot password?
 Register
Search
Author: 张阿大

Please masters to help write an algorithm !!

[Copy link]

1

Threads

12

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-6-15 13:15:01
| Show all posts
I don’t want to standardize it, I just want it to be editable, and test it. I’ve typed it out with you, wrong.
Reply

Use magic Report

1

Threads

21

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-6-15 13:45:01
| Show all posts
class T
{
static String str34[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
                "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M",
                "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
public static void main(String[] args)
{
System.out.println("Hello World!");
function(4,34,"");
}
public static void function(int p,int d,String arg){
if(p==0){System.out.println(arg); return;}
for(int i=0;i<d;i++){
arg+=str34[i];
function(p-1,d,arg);
arg=arg.substring(0,arg.length()-1);}
}
}
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-15 17:00:01
| Show all posts
package javaTest;

public class Test1 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO automatically generates method stubs
String[] strAr= {"1","2","3","4","5","6","7","8","9","A","B", "C","D","E","F","G","H","J","K","L","M","N","P","Q ","R","S","T","U","V","W","X","Y","Z"};
String num = "0000";
int s=0;
int genum=0, shinum=0, bainum=0, qiannum=0;
int length=strAr.length;
while(true){
s++;
genum++;
if(genum<length){
num=num.substring(0,2)+strAr[genum-1];
}else{
genum=0;
shinum++;
if(shinum<length){
num=num.substring(0,1)+strAr[shinum-1]+"0";
}else{
shinum=0;
bainum++;
if(shinum<length){
num=num.substring(0,0)+strAr[bainum-1]+"00";
}else{
bainum=0;
qiannum++;
if(qiannum<length){
num=strAr[qiannum-1]+"000";
}else{
break;
}
}
}
}
System.out.println(s+":"+num);
}
}
The
}
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-15 21:30:01
| Show all posts
I have a question, I'm sorry, I am also a novice, I will take a look
Reply

Use magic Report

1

Threads

12

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-6-15 22:45:02
| Show all posts
Wow, the big brother upstairs has a good history. At such a high level, please explain the code above, thank you very much!
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-16 09:15:01
| Show all posts
public class Test1 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO automatically generates method stubs
String[] strAr= {"1","2","3","4","5","6","7","8","9","A","B", "C","D","E","F","G","H","J","K","L","M","N","P","Q ","R","S","T","U","V","W","X","Y","Z"};
String num = "0000";
int s=0;
int genum=0, shinum=0, bainum=0, qiannum=0;
int length=strAr.length;
while(true){
System.out.println(s+":"+num);
s++;
genum++;
if(genum<=length){
num=num.substring(0,3)+strAr[genum-1];
}else{
genum=0;
shinum++;
if(shinum<=length){
num=num.substring(0,2)+strAr[shinum-1]+"0";
}else{
shinum=0;
bainum++;
if(shinum<=length){
num=num.substring(0,1)+strAr[bainum-1]+"00";
}else{
bainum=0;
qiannum++;
if(qiannum<=length){
num=strAr[qiannum-1]+"000";
}else{
break;
}
}
}
}
}
}
The

}
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-16 10:15:01
| Show all posts
The above is good, take a look
Reply

Use magic Report

1

Threads

12

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 LAN

 Author| Post time: 2020-6-17 21:45:01
| Show all posts
Brother, an exception was thrown.
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-18 02:30:01
| Show all posts
This is good, I debugged it and it ran all the time
public class Test1 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO automatically generates method stubs
String[] strAr= {"1","2","3","4","5","6","7","8","9","A","B", "C","D","E","F","G","H","J","K","L","M","N","P","Q ","R","S","T","U","V","W","X","Y","Z"};
String num = "0000";
long s=0;
int genum=0, shinum=0, bainum=0, qiannum=0;
int length=strAr.length;
while(true){
System.out.println(s+":"+num);
s++;
genum++;
if(genum<=length){
num=num.substring(0,3)+strAr[genum-1];
}else{
genum=0;
shinum++;
if(shinum<=length){
num=num.substring(0,2)+strAr[shinum-1]+"0";
}else{
shinum=0;
bainum++;
if(bainum<=length){
num=num.substring(0,1)+strAr[bainum-1]+"00";
}else{
bainum=0;
qiannum++;
if(qiannum<=length){
num=strAr[qiannum-1]+"000";
}else{
break;
}
}
}
}
}
}
The

}
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-19 15:00:02
| Show all posts
Isn't it alright?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list