Win a copy of Rust Web Development this week in the Other Languages forum!

beu curt

Greenhorn
+ Follow
since Jan 16, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by beu curt

I've been reading this for awhile now, but I just can't figure the flow and idea of this code.



Any explanation would be very helpful, thank you
10 years ago

fred rosenberger wrote:

try this:



It stopped the error but it did not align the elements. Thank you
10 years ago

Here is what I am trying



Here is my error






What I am trying do is align all the elements regardless of the place value.
10 years ago
I'm still not able to align the elements.

Here is what I am doing


If the answer to equation exceeds place value compare to the element on its side, it messes up the pattern.
When I tried to use %f it gave me an error.



I managed it


Did you use printf?


10 years ago
Hello



The values are in double. How can attain that format?
Thak you very much.
LOL I can't make the column straight But what I am trying to do is align all the elements.
10 years ago

Wouter Oet wrote:No. More like this:

variable x = input()
loop
variable result = calculation(x)
print result
x = result
end loop



You made it work I owe you my life.

Thank very much.
10 years ago

Wouter Oet wrote:Then just assign the result to the input variable at the end of an iteration.

example:
equation = x + 2
input=1

1+2=3
x = 3

x+2
3+2=5
x = 5

x+2
5+2=7

and so on



you meant like this?
10 years ago

Wouter Oet wrote:I'm not sure what your problem is. Is it that it only asks for input once? In that case that is because you're only asking for input once, it is not in the for loop. If it's regarding the calculation then you need to provide us with more information.

By the way: look at the difference between System.out.print and System.out.printf.



Yep it only asks for one input. The answer for the first input should be the the next value to substituted.
10 years ago
Hi!

So basically this program will stop at 15 iterations. My problem is I am not able to substitute the value of the answer to the equation.

Here is the code



The output should be



But the one I am getting is



I am really getting frustrated, I can't figure it out. Any help would be very helpful.

Thank you
10 years ago

Henry Wong wrote:
Interesting homework problem ...

Basically, this is an sort problem, except the sorting is done for you. Normally, the initial unordered list is provided, and you have to sort it -- using an algorithm that moves the elements.

Here, the problem is... you don't know the original unordered list, but you do know the moves that it takes to sort them. So, given an unordered (and unmarked) list, and the moves it takes to sort them, find out the ordering of the original list.

Henry



Thanks, but I still don't get it
11 years ago
I have read it more than 100+, but I still can't figure it out.
The problem is confusing and I don't get what it wants me to do.

In Byteland it is always the military officer's main worry to order his soldiers on parade correctly.
Luckily, ordering soldiers is not really such a problem. If a platoon consists of n men, all of them have different rank (from 1 - lowest to n - highest)
and on parade they should be lined up from left to right in increasing order of rank.

Sounds simple, doesn't it? Well, Sgt Johnny thought the same, until one day he was faced with a new command.
He soon discovered that his elite commandos preferred to do the fighting, and leave the thinking to their superiors.
So, when at the first rollcall the soldiers lined up in fairly random order it was not because of their lack of discipline, but simply
because they couldn't work out how to form a line in correct order of ranks. Sgt Johnny was not at all amused, particularly as
he soon found that none of the soldiers even remembered his own rank. Over the years of service every soldier had only
learned which of the other soldiers were his superiors. But Sgt Johnny was not a man to give up easily when faced with a
true military challenge. After a moment's thought a solution of brilliant simplicity struck him and he issued the following
order: "men, starting from the left, one by one, do: (step forward; go left until there is no superior to the left of you; get back in line).".
This did indeed get the men sorted in a few minutes. The problem was solved... for the time being.

The next day, the soldiers came in exactly the same order as the day before, and had to be rearranged using the same method.
History repeated. After some weeks, Sgt Johnny managed to force each of his soldiers to remember how many men he passed
when going left, and thus make the sorting process even faster.

If you know how many positions each man has to walk to the left, can you try to find out what order of ranks the soldiers initially line up in?
Input

The first line of input contains an integer t<=50, the number of test cases. It is followed by t test cases, each consisting of 2 lines.
The first line contains a single integer n (1<=n<=200000). The second line contains n space separated integers wi, denoting how far
the i-th soldier in line must walk to the left when applying Sgt Johnny's algorithm.
Output

For each test case, output a single line consisting of n space separated integers - the ranks of the soldiers, given from left to right
in their initial arrangement.
Example

Input:
2
3
0 1 0
5
0 1 2 0 1

Output:
2 1 3
3 2 1 5 4



Any explanations would be very helpful.
Thank you
11 years ago

Campbell Ritchie wrote:Please find the class whose name you are getting the problems with, and tell us exactly where you have got the .class file.



This is the whole program. I posted everything.

I think the problem is line number 8:

11 years ago

Christophe Verré wrote:The compiler does not find the AddressBookEntry class because it's not in the CLASSPATH
1. Where is AddressBookEntry.class ?
2. How did you compile AddressBook ?



A big noob here, can't understand what you are trying to explain.
sorry
11 years ago
The program is an Address Book. and I cant get rid of the "cannot find symbol class" error, what should I do?

here is the code:



Here is the error:
11 years ago
OK here is the problem my friend gave:
Get input from the user using command-line arguments and print all the arguments to the screen. For example, if the user entered,

Java Hello world that is all

your program should print

Hello
world
that
is
all


I press shift + f6 to make the program run, I'm using netbeans.O.O
12 years ago