[infostudents] Re: [infostudents] Stochastik Aufgabe 5 einfach mal zählen

  • From: "Jonas Gehring" <jonas.gehring@xxxxxxxxxxxx>
  • To: infostudents@xxxxxxxxxxxxx
  • Date: Sun, 18 May 2008 19:07:04 +0200

Ich denke dein Code zählt die Tupel doppelt. Ich hab einfach
angenommen dass die Ordnung der Zahlen im Tupel keine Rolle spielt und
die kleinere obda inks steht. Des weiteren hab ich auch Tupel (i,j)
mit i=j gelten lassen.

Gruß,
Jonas


2008/5/18, Guido Solbach <ich@xxxxxxxxxxxxxxxx>:
> public class tupel {
>
>    /**
>     * @param args
>     */
>    public static void main(String[] args) {
>        int count =0;
>        int match = 0;
>        for(int i=0;i<100;i++){
>            for(int j=0;j<100;j++){
>                if(i!=j){
>                    count++;
>                    if((i<20&&j>78)||(j<20&&i>78)){
>                        match++;
>                    }
>                }
>            }
>        }
>        System.out.println(count);
>        System.out.println(match);
>    }
>
>  }
>
>
>  Da kommt 840 / 9900 raus
>  Das habe ich auch ganz anders berechnet ;-)
>  ---
>  Sent through the Infostudents Mailinglist
>
>  List Archive:
>  //www.freelists.org/archives/infostudents/
>
>  Subscribe / Unsubscribe:
>  //www.freelists.org/list/infostudents
>
---
Sent through the Infostudents Mailinglist

List Archive:
//www.freelists.org/archives/infostudents/

Subscribe / Unsubscribe:
//www.freelists.org/list/infostudents

Other related posts: