gutefrage.net, die Ratgeber Community
Login   |  Registrieren   |  Forum |  Richtlinien & FAQ


kann jemand das lösen:

gefragt von FunSelFunSel am 08.08.2009 um 22:48 Uhr

Peter, Simon und Daniel sollen zwei Zahlen herausfinden. Hierfür erhalten sie folgende Informationen: Beide Zahlen liegen im Bereich von 1 bis 1000, und beide sind ganzzahlig (also keine Kommazahlen), und es wäre auch möglich, dass beide Zahlen identisch sind. Peter erfährt zudem das Produkt der beiden Zahlen, Simon bekommt die Summe, und Daniel die Differenz.

Daraufhin kommt es zu folgendem Gespräch:

Peter: Ich kenne die Zahlen nicht.

Simon: Das brauchst Du mir nicht zu sagen, denn das wusste ich schon.

Peter: Dann kenne ich die Zahlen jetzt.

Simon: Ich kenne sie jetzt auch.

Daniel: Ich kenne die beiden Zahlen noch nicht. Ich kann nur eine Zahl vermuten, die wahrscheinlich dabei ist, aber sicher weiß ich's nicht.

Peter: Ich weiß, welche Zahl Du vermutest, aber die ist falsch.

Daniel: OK, dann kenne ich jetzt auch beide Zahlen.

das ist auf jeden fall lösbar! auf http://www.onlinewahn.de/ steht auch noch ein hinweis einfach mal auf rätsel spaß und dann die schwierigsten rätsel zahlenrätsel lg funsel


Support
Kommentar zur Frage vom Support

Liebe/r FunSel, gutefrage.net ist eine Ratgeber-Plattform und kein Rätsel-Forum. Deine Frage ist hier fehl am Platz. Bitte beachte künftig unsere Richtlinien unter http://www.gutefrage.net/policy. Deine Beiträge werden sonst gelöscht. Vielen Dank für Dein Verständnis! Schöne Grüße Jörg vom gutefrage.net-Support

Weitere Fragen zu verwandten Themen finden Sie hier:

mathe (3722)
schlau-lol (1)
ähnliche Fragen
Frage beantworten


Vom Fragesteller als hilfreichste Antwort ausgezeichnet


krokoll06
beantwortet von krokoll06 am 8. August 2009 22:51
1x
Die Antwort ist hilfreich? Dann klick mich!
Hilfreichste Antwort

64 und 73 :-)

Kommentar von Simple_avatar4smallFunSel am 8. August 2009 22:55

wow wie hast du das denn gelöst?!

Kommentar von Cc7438bf31299a8999bb70e1ca5b989bsmallbaybora am 8. August 2009 22:56

frag ich mich jetzt auch....^^

Kommentar von Simple_avatar2smallkrokoll06 am 8. August 2009 23:08
Kommentar von Simple_avatar2smallkrokoll06 am 8. August 2009 23:12

und glaubt mir wer von programmieren keine ahnung hat bekommt es nie hin ;-) die seite gehört mir hatte die frage schon mal und hab sie onlne gestellt war auch eine aufgabe im Kurs

Kommentar von Simple_avatar4smallFunSel am 8. August 2009 23:14

ah lol


Weitere gute Antworten


Guppy194
beantwortet von Guppy194 am 8. August 2009 23:26
1x
Die Antwort ist hilfreich? Dann klick mich!

für die lösung hat ein Spezialist folgendes Programm geschrieben: (ich kapiers aber nicht)

include<iostream> using namespace std;

class cell { public: int a; int b; int p; cell* next; cell* pre; };

void erzeugetabelle(cell*&, cell*&, unsigned); void quicksort(cell*, cell*); void tausche(cell*, cell*); void reduziere(cell*&, cell*&); void schreibelua(cell, cell, int); bool ist_in_liste(int, int, int=0, int=103359); void erzeugesummen(int*&, int*&); void reduzierep(cell, cell, int, int); void reduzieres(int*, int*, int*); void sortierediff(int); void reduziere_d(int, int); void checke_diff(int, int*);

int main() { cout<<"\n(1)\n p erzeugen ....... "; cell produkte; cell* ph1=&produkte; cell* ph2=0; erzeugetabelle(ph1, p_h2, 1000); cout<<"done\n";

cout&lt;&lt;&quot;        p sortieren ...... &quot;;
quicksort(p_h1, p_h2);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;        p reduzieren ..... &quot;;
reduziere(p_h1, p_h2);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;        p kopieren ....... &quot;;
int lua[103360]={0};
int* p_lua=&amp;lua[0];
schreibe_lua(p_h1, p_h2, p_lua);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;\n(2)\n        s reduzieren ..... &quot;;
int summen[235];
int* p_summen=&amp;summen[0];
erzeuge_summen(p_lua, p_summen);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;\n(3)\n        p reduzieren ..... &quot;;    
int prod[6984];
reduziere_p(&amp;produkte, p_h2, &amp;summen[0], &amp;prod[0]);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;\n(4)\n        s reduzieren ..... &quot;;    
int diff[81]={0};
reduziere_s(&amp;summen[0], &amp;prod[0], &amp;diff[0]);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;        d sortieren ...... &quot;;
sortiere_diff(&amp;diff[0]);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;\n(5)\n        d reduzieren ..... &quot;;    
int diff_new[81]={0};
reduziere_d(&amp;diff[0], &amp;diff_new[0]);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;\n(6)+(7)\n        d reduzieren ..... &quot;;    
int ergebnis[3]={0};
checke_diff(&amp;diff_new[0], &amp;ergebnis[0]);
cout&lt;&lt;&quot;done\n&quot;;

cout&lt;&lt;&quot;\n\n die gesuchten zahlen sind &quot;&lt;&lt;ergebnis[1]&lt;&lt;&quot; und &quot;&lt;&lt;ergebnis[2]&lt;&lt;&quot;\n&quot;;

}

void erzeugetabelle(cell*& p01, cell& p_02, unsigned n) { cell start=p01; p01->pre=0; p02=p01; for(int i=1; i<=n; ++i) { for(int j=1;j<=i; ++j) { p01->a=i; p01->b=j; p01->p=i*j; p01->next=new cell; p02=p01->next; p02->pre=p01; p01=p02; } } p01=start; p02=p02->pre; p02->next=0; }

void quicksort(cell* left, cell* right) {
cell* l=left; cell* r=right; int pivot=(l->p+r->p); while(l!=r) { while(r->p2>=pivot && l!=r) { r=r->pre; } while(l->p2<pivot && l!=r) { l=l->next; } tausche(l,r); } if(left!=l && l!=right) {
quicksort(left,l); } if(r!=right) {
quicksort(r->next,right); } }

void tausche(cell* l, cell* r) { if(l!=r) { int tmp=l->p; l->p=r->p; r->p=tmp;

    tmp=l-&gt;a;
    l-&gt;a=r-&gt;a;
    r-&gt;a=tmp;

    tmp=l-&gt;b;
    l-&gt;b=r-&gt;b;
    r-&gt;b=tmp;
}

}

void reduziere(cell& start, cell& end) { cell* pa=start; cell* pb=pa->next; cell* pc=pb->next; if(pa->p!=pb->p) // listenanfang {
while(p
b->p!=pc->p && pc->next!=0) { pb=pc; pc=pc->next; } tausche(pa,pb); pa->next=pc; pc->pre=pa; pb=pc; pc=pc->next; } while(pb!=end) // liste { if(pa->p!=pb->p && pb->p!=pc->p) { pa->next=pc; pc->pre=pa; pb=pc; pc=pc->next; } else { pa=pb; pb=pc; pc=pc->next; } } if(pa->p!=pb->p) // listenende { end=pa; end->next=0; } }

void schreibe_lua(cell* start, cell* end, int* lua) { cell* help=start; cell* helper=start->next; lua[0]=start->p; int counter=1; while(helper!=end) { if(help->p!=helper->p) { lua[counter]=helper->p; ++counter; } help=helper; helper=helper->next; } }

bool istinliste(int a, int* list, int left, int right) { if(left==right) { if(list[left]==a) { return true; } else { return false; } } if(list[(left+right)/2]<a && list[(left+right)/2]!=0) { return istinliste(a, list, (left+right)/2+1, right); } else { return istinliste(a, list, left, (left+right)/2); } }

void erzeugesummen(int*& plua, int& p_sum) { int counter=0; bool test; for(int i=2; i<=2000; ++i) { test=true; for(int j=1; j<=i-j; ++j) { if(!ist_in_liste(j(i-j),plua)) { test=false; } } if(test) { psum[counter]=i; ++counter; } } }

void reduzierep(cell* t, cell* tend, int* s, int* p) { int tmp; int count=0; int counter=0; bool end=false; do { tmp=t->p; counter=0; while(t->p==tmp && !end) { if(istinliste(t->a+t->b, s, 0, 234)) { ++counter; } if(t==tend) { end=true; } else { t=t->next; } } if(counter==1) { p[count]=tmp; ++count; } } while(t!=tend); }

void reduzieres(int* s, int* p, int* d) { int tmp; int count=0; int counter=0; for(int i=0; i<235; ++i) { counter=0; for(int j=1; j<=s[i]-j; ++j) { if(istin_liste(j*(s[i]-j), p, 0, 6983)) { ++counter; if(counter==1) { tmp=j; } } } if(counter==1) { d[count]=s[i]-tmp-tmp; d[count+1]=tmp; d[count+2]=s[i]-tmp; count+=3; } } }

void sortierediff(int* d) { int tmp; for(int i=2; i<27; ++i) { for(int j=0; j*3<=80-i*3; ++j) { if(d[j*3]>d[(j+1)*3]) { for(int k=0; k<=2; ++k) { tmp=d[j*3+k]; d[j*3+k]=d[(j+1)*3+k]; d[(j+1)*3+k]=tmp; } } } } } void reduziered(int* do, int* dn) { int a,b,d,tmp,k,count=0; bool doppelt; int i=0; while(i<=75) { if(do[i]!=do[i+3]) { i+=3; } else { doppelt=false; k=0;
d=do[i]; while(d==do[i+k]) { a=do[i+k+1]; b=do[i+k+2]; tmp=i+k+3; while(d==do[tmp] && tmp<=78) { if(do[tmp+1]==a || do[tmp+1]==b || do[tmp+2]==a || do[tmp+2]==b) { doppelt=true; } tmp+=3; } k+=3; } while(d==do[i] && i<=78) { if(doppelt) { dn[count]=do[i]; dn[count+1]=do[i+1]; dn[count+2]=do[i+2]; count+=3; } i+=3; } } } } void checke_diff(int* d, int* e) { int i=0; while(d[i]!=0) { if(d[i+1]==d[i+4] || d[i+2]==d[i+4] || d[i+1]==d[i+5] || d[i+2]==d[i+5]) { e[0]=d[i+6]; e[1]=d[i+7]; e[2]=d[i+8]; } else if(d[i+1]==d[i+7] || d[i+2]==d[i+7] || d[i+1]==d[i+8] || d[i+2]==d[i+8]) { e[0]=d[i+3]; e[1]=d[i+4]; e[2]=d[i+5]; } else { e[0]=d[i]; e[1]=d[i+1]; e[2]=d[i+2]; } i+=9; } }


when he rolls up his sleeves he ain't just puttin' on the ritz ... ... our god is an awesome god! Offline

18 2007-03-11 22:04:39

daniel Senior Member

Ort: boeblingen Registriert: 2002-05-03 Beiträge: 2065 Webseite Re: Zahlenrätsel... falls du irgendwelche erklaerungen zum code haben moechtest: einfach fragen!

Kommentar von Simple_avatar4smallFunSel am 9. August 2009 12:39

ja ich auch nich^^



Noch nicht die richtige Antwort? Dann hier in allen Fragen und Tipps suchen:




Verwandte Fragen

Verwandte Fragen


Mehr verwandte Fragen

Verwandte Fragen
Die unter gutefrage.net angebotenen Dienste und Ratgeber Inhalte werden nicht geprüft. Die Richtigkeit der Inhalte wird nicht gewährleistet. Bitte lesen Sie hierzu auch unsere Rechtlichen Hinweise.