Last active
August 29, 2015 14:09
-
-
Save tkrs/82541c32417eea5f072d to your computer and use it in GitHub Desktop.
This file contains 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
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.stream.IntStream; | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
int ans = new BufferedReader( | |
new InputStreamReader(System.in)) | |
.lines() | |
.skip(1) | |
.map(s -> s.split(" ")) | |
.flatMapToInt(xs -> { | |
String d = xs[0]; | |
int p = Integer.parseInt(xs[1]); | |
return IntStream.of((int)( | |
d.contains("3") ? p * 0.03: | |
d.contains("5") ? p * 0.05: | |
p * 0.01)); | |
}) | |
.sum(); | |
System.out.println(ans); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment