"Shawn-lanqiao" eighth Waterloo Cup national race JAVAB Group __java

Source: Internet
Author: User
Tags set set stub
Title 1:10 Digits of square
By 0~9 These 10 numbers are not repeated, not omitted, can constitute a lot of 10 digits.
And there's a lot of it that happens to be the square number (the square of a number).
For example: 1026753849, is the smallest one of the square number.
Please find out what the biggest square number is.

Note: You need to submit a 10-digit number, do not fill in any excess content.

Panel member 1:

Package com.bcu.Two;

public class Lianxi {public

	static void Main (string[] args) {
		//TODO auto-generated method stub for

		(Long a = 99380;; a--) {
			long B =  a*a;
			int f = fun (b);
			if (f==1) {
				System.out.println (b);
				break;
				}

	}} public static int Fun (long b) {
		int [] shu = new int [;
		] int t = 0;
		for (int i = 0;i<10;i++) {
			shu[i] = (int) (B%10);
			b = B/10;
		}
		for (int k = 0;k<10;k++) {for
			(int j = k+1;j<10;j++) {
				if (shu[k]==shu[j)) {
					t = 0;
					break;
				else{
					t = 1;
					Continue
				}
			}
			if (t==0) {break
				;
			} else{
				continue
			}
		}
		
		return t;
	}
}



Panel member 2:

public class Test {public

	static void Main (string[] args) {
		//TODO auto-generated method stub
		Long i = 99066 ;		
		String s = i * i + "";
 		while (s.length () = =) {
			if (Noname (s)) {
				continue;
			}
			if (Noname (s) = = False) {
				System.out.println (i * i);
				break;
			i--
		} 
	}
	public static Boolean Noname (String a) {to
		(int i = 0; i < 9; i++) {for
			(int j = i + 1; j <= 9; j +) { C18/>if (A.charat (i) = = A.charat (j)) {return
				true
				;
			}
		}} return false;
	}
}



Panel member 3:

Package national race;

Import Java.math.BigInteger;
Import Java.util.HashSet;
Import Java.util.Set;

public class Test1 {public
	static void Main (string[] args) {
		BigInteger x;
		BigInteger y = new BigInteger ("ten");
		Biginteger[] A = new biginteger[10];
		String s = "32043";
		String s2 = "100000";
		BigInteger t = new BigInteger (s2);
		for (BigInteger B = new BigInteger (s); B.compareto (t) <= 0; b = b.add (New BigInteger ("1"))) {
			x = b.multiply (b); 
  for (int m = 9; M >= 0; m--) {
				a[m] = X.remainder (y);
				x = X.divide (y);
			}
			Set set = new HashSet ();
			for (int i = 0; i < a.length i++) {
				set.add (a[i]);
			if (set.size () = = a.length) {
				System.out.println (b);
				Break;}}}






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.