import java.util.Scanner;
/**
* Created by junyi.pc on 2017/1/25.
*/
public class Main {
static int count1 = 0;
public static void f(double a[],int n,int cur){
if(cur==9){
if(a[0]+a[1]/a[2]+((a[3]*100+a[4]*10+a[5])/(a[6]*100+a[7]*10+a[8]))==10){
count1++;
System.out.println(a[0]+"+"+a[1]+"/"+a[2]+"+"+a[3]+"*"+a[4]+"*"+a[5]+"/"+a[6]+"*"+a[7]+"*"+a[8]+"n=="+count1);
}
return ;
}
for(int i=1;i<=n;i++){
boolean ok=true;
for(int j=0;j<cur;j++){
if(a[j]==i)
ok=false;
}
if(ok==true){
a[cur]=i;
f(a,9,cur+1);
}
}
}
public static void main(java.lang.String[] args){
double a[]={1,2,3,4,5,6,7,8,9};
f(a,9,0);
}
}
import java.util.Scanner;
/**
* Created by junyi.pc on 2017/1/25.
*/
public class Main {
static int count1 = 0;
public static void f(double a[],int n,int cur){
if(cur==10){
if(a[0]<a[1]&&a[0]<a[2]&&a[1]<a[3]&&a[1]<a[4]&&a[2]<a[4]&&a[2]<a[5]&&a[3]<a[6]&&a[3]<a[7]&&a[4]<a[7]&&a[4]<a[8]&&a[5]<a[8]&&a[5]<a[9]){
count1++;
System.out.println(a[0]+""+a[1]+a[2]+""+a[3]+""+a[4]+""+a[5]+""+a[6]+""+a[7]+""+a[8]+""+a[9]+"n=="+count1);
}
return ;
}
for(int i=0;i<n;i++){
boolean ok=true;
for(int j=0;j<cur;j++){
if(a[j]==i)
ok=false;
}
if(ok==true){
a[cur]=i;
f(a,10,cur+1);
}
}
}
public static void main(java.lang.String[] args){
double a[]={0,1,2,3,4,5,6,7,8,9};
f(a,10,0);
}
}
import java.util.Scanner;
/**
* Created by junyi.pc on 2017/1/25.
*/
public class Main {
public static void f(int a[],int k,int m,char b[]) {
if(k==6){
b[5]=0;
if (m==0){
for(int n=0;n<6;n++)
System.out.print(b[n]);
System.out.println();
}
return;
}
for(int i=0;i<=a[k];i++){
for(int j=0;j<i;j++){
b[5-m+j]=(char)(k+'A');
}
f(a,k+1,m-i,b);
}
}
public static void main(java.lang.String[] args){
int a[]={4,2,2,1,1,3};
char b[]=new char[1024];
f(a,0,5,b);
}
}
import java.util.Scanner;
/**
* Created by junyi.pc on 2017/1/25.
*/
public class Main {
public static void f(int m,int n) {
int row;
int col;
for(row=0;row<n;row++){
for(col=0;col<m;col++){
System.out.print("+---");
}
System.out.println("+");
for(col=0;col<m;col++){
System.out.print("|"+" ");
}
System.out.println("|");
}
System.out.print("+");
for(col=0;col<m;col++){
System.out.print("---+");
}
System.out.println();
}
public static void main(java.lang.String[] args){
f(10,4);
}
}
import java.util.Scanner;
/**
* Created by junyi.pc on 2017/1/25.
*/
public class Main {
public static void f(int x) {
int i;
for(i=0;i<32;i++)
System.out.print((x>>(31-i))&1);
System.out.println();
x=x^((~x&(-(~x)))-1);
for(i=0;i<32;i++)
System.out.print((x>>(31-i))&1);
System.out.println();
}
public static void main(java.lang.String[] args){
f(103);
f(12);
}
}
网友评论