gregergegergre3rg
Printable View
gregergegergre3rg
TeachNoteMeHowToSpeakEnglish
*slap*
bgrehy5hjw5y
Code:[object Object]
Code:bgrehy5hjw5y
http://www.vbforums.com/attachment.p...postid=1772157Code:[object Object]
c++:
Code:import java.util.*;
class CircleDance
{
public int arrangeDancers(int[] heights)
{
int[] lowestSoFar = heights;
Collections.reverse(Arrays.asList(heights));
if (heights.length == 3)
{
return heights[heights.length-1] - heights[0];
}
int maxDifference = heights[heights.length-1]-heights[0];
int temp;
int temp2;
for (int back=heights.length-1; back>=0; back--)
{
for(int front=0; front<heights.length; front++)
{
if (front == heights.length-1)
{
if (heights[front] > heights[0])
{
temp = heights[front];
temp2 = heights[0];
heights[front] = temp2;
heights[0] = temp;
}
}
else if (front < heights.length-1)
{
if (heights[front] > heights[front+1])
{
temp = heights[front];
temp2 = heights[front+1];
heights[front] = temp2;
heights[front+1] = temp;
for (int i=0; i<heights.length; i++)
{
if (i == heights.length-1)
{
if ((heights[i]+heights[0]) < maxDifference)
{
maxDifference = heights[i] + heights[0];
}
}
else if (i < heights.length-1)
{
if ((heights[i] + heights[i+1]) < maxDifference)
{
maxDifference = heights[i] + heights[i+1];
}
}
}
if ((heights[0] + heights[heights.length-1]) < maxDifference)
{
maxDifference = heights[0] + heights[heights.length-1];
}
}
}
}
}
return maxDifference;
}
public static void main(String[] args)
{
int[] d = {170,180,190};
CircleDance cd = new CircleDance();
System.out.println(cd.arrangeDancers(d));
}
}
java:
Code:import java.util.*;
class CircleDance
{
public int arrangeDancers(int[] heights)
{
int[] lowestSoFar = heights;
Collections.reverse(Arrays.asList(heights));
if (heights.length == 3)
{
return heights[heights.length-1] - heights[0];
}
int maxDifference = heights[heights.length-1]-heights[0];
int temp;
int temp2;
for (int back=heights.length-1; back>=0; back--)
{
for(int front=0; front<heights.length; front++)
{
if (front == heights.length-1)
{
if (heights[front] > heights[0])
{
temp = heights[front];
temp2 = heights[0];
heights[front] = temp2;
heights[0] = temp;
}
}
else if (front < heights.length-1)
{
if (heights[front] > heights[front+1])
{
temp = heights[front];
temp2 = heights[front+1];
heights[front] = temp2;
heights[front+1] = temp;
for (int i=0; i<heights.length; i++)
{
if (i == heights.length-1)
{
if ((heights[i]+heights[0]) < maxDifference)
{
maxDifference = heights[i] + heights[0];
}
}
else if (i < heights.length-1)
{
if ((heights[i] + heights[i+1]) < maxDifference)
{
maxDifference = heights[i] + heights[i+1];
}
}
}
if ((heights[0] + heights[heights.length-1]) < maxDifference)
{
maxDifference = heights[0] + heights[heights.length-1];
}
}
}
}
}
return maxDifference;
}
public static void main(String[] args)
{
int[] d = {170,180,190};
CircleDance cd = new CircleDance();
System.out.println(cd.arrangeDancers(d));
}
}
mytest, he said with a hope in his voice:
Quote:
import java.util.*;
class CircleDance
{
public int arrangeDancers(int[] heights)
{
int[] lowestSoFar = heights;
Collections.reverse(Arrays.asList(heights));
if (heights.length == 3)
{
return heights[heights.length-1] - heights[0];
}
int maxDifference = heights[heights.length-1]-heights[0];
int temp;
int temp2;
for (int back=heights.length-1; back>=0; back--)
{
for(int front=0; front<heights.length; front++)
{
if (front == heights.length-1)
{
if (heights[front] > heights[0])
{
temp = heights[front];
temp2 = heights[0];
heights[front] = temp2;
heights[0] = temp;
}
}
else if (front < heights.length-1)
{
if (heights[front] > heights[front+1])
{
temp = heights[front];
temp2 = heights[front+1];
heights[front] = temp2;
heights[front+1] = temp;
for (int i=0; i<heights.length; i++)
{
if (i == heights.length-1)
{
if ((heights[i]+heights[0]) < maxDifference)
{
maxDifference = heights[i] + heights[0];
}
}
else if (i < heights.length-1)
{
if ((heights[i] + heights[i+1]) < maxDifference)
{
maxDifference = heights[i] + heights[i+1];
}
}
}
if ((heights[0] + heights[heights.length-1]) < maxDifference)
{
maxDifference = heights[0] + heights[heights.length-1];
}
}
}
}
}
return maxDifference;
}
public static void main(String[] args)
{
int[] d = {170,180,190};
CircleDance cd = new CircleDance();
System.out.println(cd.arrangeDancers(d));
}
}
Here is java now. Or do you want me to base the color from Cander's original?Code:import java.util.*;
class CircleDance
{
public int arrangeDancers(int[] heights)
{
int[] lowestSoFar = heights;
Collections.reverse(Arrays.asList(heights));
if (heights.length == 3)
{
return heights[heights.length-1] - heights[0];
}
int maxDifference = heights[heights.length-1]-heights[0];
int temp;
int temp2;
for (int back=heights.length-1; back>=0; back--)
{
for(int front=0; front<heights.length; front++)
{
if (front == heights.length-1)
{
if (heights[front] > heights[0])
{
temp = heights[front];
temp2 = heights[0];
heights[front] = temp2;
heights[0] = temp;
}
}
else if (front < heights.length-1)
{
if (heights[front] > heights[front+1])
{
temp = heights[front];
temp2 = heights[front+1];
heights[front] = temp2;
heights[front+1] = temp;
for (int i=0; i<heights.length; i++)
{
if (i == heights.length-1)
{
if ((heights[i]+heights[0]) < maxDifference)
{
maxDifference = heights[i] + heights[0];
}
}
else if (i < heights.length-1)
{
if ((heights[i] + heights[i+1]) < maxDifference)
{
maxDifference = heights[i] + heights[i+1];
}
}
}
if ((heights[0] + heights[heights.length-1]) < maxDifference)
{
maxDifference = heights[0] + heights[heights.length-1];
}
}
}
}
}
return maxDifference;
}
public static void main(String[] args)
{
int[] d = {170,180,190};
CircleDance cd = new CircleDance();
System.out.println(cd.arrangeDancers(d));
}
}
You could copy the PHP higghlighting :)
PHP Code:$var = 1;
$string = 'string';
$string1 = "string\r\n";
/* comment */
// comment
function name ($param1, $param2) {
if ($param1 == 1) {
echo('name');
}
return;
}
Ok, I'll try. Just can't promise much. But I'll try.
You are very smart - I have faith in your abilities :D
Haha. That's funny. I've never heard one of those since 10.
Edit: We'll also be expecting your Delphi syntax highlighter. :bigyello:
Get to work - *whip*whip* :D
Test 1
Test2Test3
Indent test in quote tag:
Quote:
function name ($param1, $param2) {
if ($param1 == 1) {echo('name');}}
normal
test 1test 1
test 2test 2
test 3test 3
test 4test 4
test 5test 5
test 6test 6
test 7test 7
- grw
- greg
- greag
- greag4r
123456789123456789
123456789,,,,,,,,,
123456789123,,,,,,