Skip to content

Instantly share code, notes, and snippets.

@bastienapp
Created November 6, 2018 18:44
Show Gist options
  • Save bastienapp/09a615df7e7ee81861d2d2d8e7f0965b to your computer and use it in GitHub Desktop.
Save bastienapp/09a615df7e7ee81861d2d2d8e7f0965b to your computer and use it in GitHub Desktop.
/*******
* Read input from System.in
* Use: System.out.println to ouput your result to STDOUT.
* Use: System.err.println to ouput debugging information to STDERR.
* ***/
package com.isograd.exercise;
import java.util.*;
public class IsoContest {
public static void main( String[] argv ) throws Exception {
String line;
Scanner sc = new Scanner(System.in);
int scoreMax = 0;
// sc.next(); récupère une chaine
// récupérer le nombre de restaurant
int nbResto = sc.nextInt();
for (int i = 0; i < nbResto; i++) {
// "20 12 15"
int note1 = sc.nextInt();
int note2 = sc.nextInt();
int note3 = sc.nextInt();
int score = note1 + note2 + note3;
if (score > scoreMax) {
scoreMax = score;
}
}
System.out.print(Math.ceil(scoreMax / 3.0));
}
}
/*******
* Read input from System.in
* Use: System.out.println to ouput your result to STDOUT.
* Use: System.err.println to ouput debugging information to STDERR.
* ***/
package com.isograd.exercise;
import java.util.*;
public class IsoContest {
public static void main( String[] argv ) throws Exception {
String line;
Scanner sc = new Scanner(System.in);
line = sc.nextLine(); // nbRestos inutile
int scoreMax = 0;
while(sc.hasNextLine()) {
line = sc.nextLine();
String[] notes = line.split(" ");
int score = 0;
for (String note : notes) {
score += Integer.parseInt(note);
}
if (score > scoreMax) {
scoreMax = score;
}
}
System.out.print(Math.ceil(scoreMax / 3.0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment