| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
JAVA AC代码。。import java.awt.List;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int i;
String input = scanner.nextLine();
int length = input.length();
List list = new List();
String temp = input;
for (i = 0; i < length - 1; i++) {
temp = temp.substring(1) + temp.charAt(0);
list.add(temp);
}
BigInteger bigInteger = new BigInteger(input);
for (i = 2; i <= length; i++) {
temp = bigInteger.multiply(new BigInteger(String.valueOf(i))).toString();
while (temp.length() < length) {
temp = '0' + temp;
}
boolean ok = false;
for (int j = 0; j < list.getItemCount(); j++) {
if (temp.equals(list.getItem(j))) {
list.remove(j);
ok = true;
break;
}
}
if (ok == false) {
break;
}
}
if (i > length) {
System.out.println(input + " is cyclic");
} else {
System.out.println(input + " is not cyclic");
}
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator