DaciaClub Logo

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> Ajutor! Java! nu ma lasati fratilor...

Slider
post 21 Jun 2008, 09:46
Post #1


Membru autentic


Group: Members
Posts: 1.279
Joined: 5 December 03
From: Cernavoda




Se da urmatorul program:

public class Test {
static int n=valoare;
static int f(int x){
if(x>n) return 0;
else return x+f(x+2);}
public static void main(String []args){
System.out.println(f(2));
}}

Ce valoare trebuie sa primeasca n pentr uca programul sa afiseze 20?
Raspunsul este 8

L-am rulat si din aproape in aproape am gasit! 8
Problema este ca ar fi trebuit sa rezolv problema fara a rula programul...
Imi poate explica cineva algoritmul? nu reusesc sa inteleg programul...


--------------------
LOGAN Ambiance - CT-xx-xxx
User is offlineGalerie FotoPM
Go to the top of the page
+
Sony
post 21 Jun 2008, 10:56
Post #2


Membru autentic


Group: Members
Posts: 2.862
Joined: 30 August 04
From: Ban Land




Bre, ti-am zis sa o lasi naibii de facultate la varsta asta! 243.gif


--------------------
Caruta cu doi cai frumosi 1945
User is offlineGalerie FotoPM
Go to the top of the page
+
Slider
post 21 Jun 2008, 11:08
Post #3


Membru autentic


Group: Members
Posts: 1.279
Joined: 5 December 03
From: Cernavoda




Ce draq sa mai fac acu'? ca am scapat de un an...mai am examenu' asta si gata!


--------------------
LOGAN Ambiance - CT-xx-xxx
User is offlineGalerie FotoPM
Go to the top of the page
+
Sony
post 21 Jun 2008, 11:19
Post #4


Membru autentic


Group: Members
Posts: 2.862
Joined: 30 August 04
From: Ban Land




Atunci tine-te de ea! wink.gif


--------------------
Caruta cu doi cai frumosi 1945
User is offlineGalerie FotoPM
Go to the top of the page
+
Slider
post 21 Jun 2008, 11:21
Post #5


Membru autentic


Group: Members
Posts: 1.279
Joined: 5 December 03
From: Cernavoda




Phiii chiar nu se pricepe nimeni? mama ei de programare...si astia nu au gasit decat java....un Basic ceva acolo n'au gasit... blush.gif

This post has been edited by Slider: 21 Jun 2008, 11:22


--------------------
LOGAN Ambiance - CT-xx-xxx
User is offlineGalerie FotoPM
Go to the top of the page
+
Sony
post 21 Jun 2008, 11:33
Post #6


Membru autentic


Group: Members
Posts: 2.862
Joined: 30 August 04
From: Ban Land




Bre, e sambata. Cred ca abia luni vei gasi pe cineva sa iti scrie la obiect, nu sa abereze ca mine.

21 Jun 2008, 12:33:
La Basic te ajutam io. 04.gif

This post has been edited by Sony: 21 Jun 2008, 11:33


--------------------
Caruta cu doi cai frumosi 1945
User is offlineGalerie FotoPM
Go to the top of the page
+
radian
post 21 Jun 2008, 12:15
Post #7


gandeste pozitiv: nu spera si nu ai teama...


Group: Members
Posts: 1.273
Joined: 17 January 05
From: petrosani




QUOTE(Sony @ 21 Jun 2008, 11:33)
...nu sa abereze ca mine...
*



Hmmm, atata sinceritate... Asta-i de pus in rama! radmasa.gif


--------------------
dacia logan ambition 2005 - HD 06 LDM
User is offlineGalerie FotoPM
Go to the top of the page
+
Shush
post 21 Jun 2008, 12:33
Post #8


٩(×̯×)۶


Group: Members
Posts: 2.117
Joined: 30 January 07
From: Brasov




Pai tu ai functia f(x) cu urmatoarele cazuri f(x)=0 pentru x>n si f(x)=2+f(x+2) in rest.
Tu vrei ca valaorea functiei sa fie 20. Primul apel al functiei va fi f(2);
f(2)=2+f(4)=2+4+f(6)=6+6+f(8)=12+8+f(10)=20+f(10) => f(10) trebuie sa fie egal cu 0 => functia trebuie sa lucreze pentru 8 dar nu si pentru 10 => n=8

Atasez si programul cu fiecare linie comentata : Attached File  prog.txt ( 832bytes ) Number of downloads: 34


This post has been edited by Shush: 21 Jun 2008, 12:34


--------------------
Seat Leon 2008 Reference 1.6 - Bv-29-Trei Litere
Yamaha YZF-R125 2009 - Bv-88-Aceleasi Trei Litere
ex Dacia Logan 2005 Laureate 1.4
If a vegetarian eats vegetables, what does a humanitarian eat ?
User is offlineGalerie FotoPM
Go to the top of the page
+
Slider
post 21 Jun 2008, 16:34
Post #9


Membru autentic


Group: Members
Posts: 1.279
Joined: 5 December 03
From: Cernavoda




aaaa...mersi mult! mie maine imi trebuia. ok ma apuc de studiat!


--------------------
LOGAN Ambiance - CT-xx-xxx
User is offlineGalerie FotoPM
Go to the top of the page
+
koldun
post 21 Jun 2008, 17:02
Post #10


un om


Group: Members
Posts: 763
Joined: 1 November 07
From: CT




De ti-o trebui, bine, de nu...
[attachmentid=1627456525]

Succese! wink.gif


--------------------
Renault Captur TCe 0.9 2016
Oh, I’m in no condition to drive! Wait a minute... I don’t have to listen to myself, I’m drunk...!
Homer Simpson
User is offlineGalerie FotoPM
Go to the top of the page
+
Slider
post 23 Jun 2008, 09:41
Post #11


Membru autentic


Group: Members
Posts: 1.279
Joined: 5 December 03
From: Cernavoda




Multumesc!


--------------------
LOGAN Ambiance - CT-xx-xxx
User is offlineGalerie FotoPM
Go to the top of the page
+
bj
post 23 Jun 2008, 10:11
Post #12


membru de nevoie


Group: Members
Posts: 321
Joined: 3 December 04
From: Bucuresti




ca sa intelegi logica functiei cauta documentatie despre recursivitate wink.gif


--------------------
Skoda / BMW Fabia Variant - de munca / F650 - capra exLeon, exDSN - B-65-xxx
BMW F650ST - tot un fel de capra
User is offlineGalerie FotoPM
Go to the top of the page
+
Slider
post 23 Jun 2008, 21:11
Post #13


Membru autentic


Group: Members
Posts: 1.279
Joined: 5 December 03
From: Cernavoda




A trecut! am scapat!!! smile.gif


--------------------
LOGAN Ambiance - CT-xx-xxx
User is offlineGalerie FotoPM
Go to the top of the page
+
Shush
post 23 Jun 2008, 22:34
Post #14


٩(×̯×)۶


Group: Members
Posts: 2.117
Joined: 30 January 07
From: Brasov




Bravo !


--------------------
Seat Leon 2008 Reference 1.6 - Bv-29-Trei Litere
Yamaha YZF-R125 2009 - Bv-88-Aceleasi Trei Litere
ex Dacia Logan 2005 Laureate 1.4
If a vegetarian eats vegetables, what does a humanitarian eat ?
User is offlineGalerie FotoPM
Go to the top of the page
+
Reply to this topicTopic OptionsStart new topic


1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
 

Lo-Fi Version  Harta site  Parteneri  Jocuri online  Curs Valutar  HRH Haine din lana merinos Time is now: 15th May 2025 - 17:06
Forum Renault