Created
November 6, 2018 18:44
-
-
Save bastienapp/09a615df7e7ee81861d2d2d8e7f0965b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******* | |
* 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)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******* | |
* 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