Skip to content

Commit 2af784f

Browse files
committed
updated
1 parent 146b7b4 commit 2af784f

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

src/Prep/winOrlose.java

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package Prep;
2+
3+
public class winOrlose {
4+
5+
public static String winorlose(int[] str,int[] ene,int n)
6+
{
7+
int min1=str[0],y=0,x,c,k=0;
8+
int[] s=new int[n];
9+
for(int i=0;i<n;i++)
10+
{
11+
if(str[i]<min1)
12+
{
13+
min1=str[i];
14+
}
15+
}
16+
for(int i=0;i<n;i++)
17+
{
18+
int min=min1;
19+
for(int j=0;j<n;j++)
20+
{
21+
if(str[j]<ene[i] && min<=str[j])
22+
{
23+
min=str[j];
24+
y=j;
25+
}
26+
}
27+
str[y]=0;
28+
s[k]=y;
29+
k++;
30+
}
31+
for(int j=0;j<n;j++)
32+
{
33+
c=0;
34+
for(int i=0;i<n;i++)
35+
{
36+
if(j==s[i])
37+
c++;
38+
}
39+
if(c>1)
40+
{
41+
return "LOSE";
42+
}
43+
}
44+
return "WIN";
45+
}
46+
public static void main(String args[] ) throws Exception {
47+
48+
// Scanner sc=new Scanner(System.in);
49+
// int t=sc.nextInt();
50+
// while(t>0)
51+
// {
52+
// int n=sc.nextInt();
53+
// int[] str=new int[n];
54+
// int[] ene=new int[n];
55+
// for(int i=0;i<n;i++)
56+
// {
57+
// str[i]=sc.nextInt();
58+
// }
59+
// for(int i=0;i<n;i++)
60+
// {
61+
// ene[i]=sc.nextInt();
62+
// }
63+
// System.out.println(winorlose(str,ene,n));
64+
// t=t-1;
65+
// }
66+
67+
}
68+
}

src/test/Check.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package test;
2+
3+
public class Check {
4+
5+
public static void main(String[] args) {
6+
System.out.println("hello world");
7+
}
8+
9+
}

0 commit comments

Comments
 (0)