X.Hijacker
پنج شنبه 29 خرداد 1393, 14:56 عصر
سلام خدمت همه ی دوستان عزیز این سوال هست :
http://sharecode.ir/section/problemset/problem/2118
ایا این کد اررور Runtime می دهد ؟
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
ArrayList<String> words = new ArrayList<String>();
int i = 0;
words.add(input.next());
while(words.get(i).charAt(0) != 'z')
{
words.add(input.next());
i++;
}
if (words.size() >= 120000) System.exit(0);
int counter = 0;
try{
while (counter != words.size()-1 ){
for (int j = 0 ; j < (words.size()-1) ; j++)
{
String s = words.get(j) + words.get(counter);
for (int c = 0 ; c < (words.size()-1) ; c++) if (s.equals(words.get(c))) {System.out.print(s + "\n"); break;}
}
counter++;
} }
catch (RuntimeException e){
System.out.print(e);
}
}
}
اگر می دهد از کجا میدهد ؟
لطفا اطلاع دهید ممنون
http://sharecode.ir/section/problemset/problem/2118
ایا این کد اررور Runtime می دهد ؟
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
ArrayList<String> words = new ArrayList<String>();
int i = 0;
words.add(input.next());
while(words.get(i).charAt(0) != 'z')
{
words.add(input.next());
i++;
}
if (words.size() >= 120000) System.exit(0);
int counter = 0;
try{
while (counter != words.size()-1 ){
for (int j = 0 ; j < (words.size()-1) ; j++)
{
String s = words.get(j) + words.get(counter);
for (int c = 0 ; c < (words.size()-1) ; c++) if (s.equals(words.get(c))) {System.out.print(s + "\n"); break;}
}
counter++;
} }
catch (RuntimeException e){
System.out.print(e);
}
}
}
اگر می دهد از کجا میدهد ؟
لطفا اطلاع دهید ممنون