Skip to content

Instantly share code, notes, and snippets.

@tkrs
Last active August 29, 2015 14:09
Show Gist options
  • Save tkrs/82541c32417eea5f072d to your computer and use it in GitHub Desktop.
Save tkrs/82541c32417eea5f072d to your computer and use it in GitHub Desktop.
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