rxk56100
BAN USER
RepDo you Need Voodoo Spell For love, revenge or voodoo spells for cheaters? Consult Free right away to get custom ...
RepPal A Roos is the best early childhood & child development center in Charlotte. We are famous offering full-time, part-time and ...
RepElenaKudaeva455, Music Piano Store at xyz
Hello Everyone,My name is Elena Kudaeva From NV,Nevada,USA.I am 16 years of age and I have ...
Repour goal is to help individuals companies and organizations of all kinds to communicate with their clients customer and employees ...
Repadorasherlyn253, SEO
I am a professor, I have 5 years of experience. I have seen a lot of cases in my life ...
RepLooking for the best child development center in Charlotte? Pal A Roos provide summer camp for children Charlotte. Our experienced ...
RepPamPucker, HR Executive at Adap.tv
I am Pam from Birmingham USA, A Secretary serves as a trusted personal assistant . My interest in ice skating, and ...
RepHazelMiller, Site Reliability Engineer at Delve Networks
Hazel Miller has been a stalwart advocate for sound public policy that advances the jobs creating potential of America’s ...
RepRocioNavarro189, None at Student
Hello Everyone,My name is Rocio Navarro Form Auckland,NZ,and 31 years old.I am searching for a servant ...
RepLarry Alvarez, Analyst at ASU
Prestige Luxury Rentals is one of the most renowned car rental companies in USA. We are locally owned and operated ...
RepAre you looking for a simple remedy mantra or solution to seduce your husband? Is your husband not caring about ...
Reppamelacochran447, Intern at design
I am Pamela Cochran, and I am working as a Manager in Compact Disc Center. Last Month, I searched for ...
RepChristinaDDooley, Tech Lead at Car Rental
Rent the stylish, royal & Luxury Cars in Miami.We have become known worldwide by providing Luxury car rental Miami and ...
Repriyanahobett, Sales Development Representative at Capgemini
I am Riyana , driven market researcher with over years of experience at Awthentikz , analyzing information in order to construct profiles ...
public class Survival {
- rxk56100 December 25, 2016public static void main(String[] args) {
int a[] = {1,2,3,4,5,6,7,8,9,10};
int b[] = {2,3,4};
System.out.println(isSurvive(a,b,9));
}
public static int isSurvive(int a[], int b[], int n){
int pos = findPos(a,n);
int curpos = pos;
for (int i=0;i<b.length;i++){
if(curpos%b[i]==0){
System.out.println("It will die at pos: "+(curpos-1));
return curpos-1;
}
else{
int temp;
temp = curpos/b[i];
curpos = curpos - temp;
}
}
System.out.println("It Survived");
return -1;
}
public static int findPos(int a[],int n){
HashMap<Integer,Integer> hm = new HashMap<Integer,Integer>();
for(int i=0;i<a.length;i++){
hm.put(a[i],i);
}
return hm.get(n) + 1;
}
}