From e5a6ec79b23f2f23f4f02809500ef107631ecb64 Mon Sep 17 00:00:00 2001 From: Fatos Morina Date: Thu, 6 Apr 2017 21:14:15 +0200 Subject: [PATCH] Add Newspaper problem description as a comment --- .classpath | 33 +++ .gitignore | 1 + .idea/workspace.xml | 597 ++++++++++++++++++++++++++++++++++++++++++ .project | 17 ++ LeetCode/LeetCode.iml | 6 + UVa/Newspaper.java | 36 ++- 6 files changed, 689 insertions(+), 1 deletion(-) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .idea/workspace.xml create mode 100644 .project create mode 100644 LeetCode/LeetCode.iml diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..ac058cb7 --- /dev/null +++ b/.classpath @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ae3c1726 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..801c3bef --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,597 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1489989983268 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 00000000..3efd2851 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + interviews + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/LeetCode/LeetCode.iml b/LeetCode/LeetCode.iml new file mode 100644 index 00000000..19dbd15d --- /dev/null +++ b/LeetCode/LeetCode.iml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/UVa/Newspaper.java b/UVa/Newspaper.java index 61d08ff9..adb025d8 100644 --- a/UVa/Newspaper.java +++ b/UVa/Newspaper.java @@ -1,3 +1,38 @@ +/*News agency pays money for articles according to some rules. Each character has its own value (some +characters may have value equals to zero). Author gets his payment as a sum of all character’s values +in the article. You have to determine the amount of money that news agency must pay to an author. +Input +The first line contains integer N (0 < N ≤ 5), it is a number of tests. Each test describes an integer +K (0 < K ≤ 100), the number of paid characters. On next K lines there are table of paid characters +and its values (character values are written in cents). If character can not be found in the table, then +its value is equal to zero. Next, there is integer M (0 < M ≤ 150000). Next M lines contain an article +itself. Each line can be up to 10000 characters length. Be aware of a large input size, the whole input +file is about 7MB. +Output +For each test print how much money publisher must pay for an article in format ‘x.yy$’. Where x is +a number of dollars without leading zeros, and yy number of cents with one leading zero if necessary. +Examples: ‘3.32$’, ‘13.07$’, ‘71.30$’, ‘0.09$’. +Sample Input +1 +7 +a 3 +W 10 +A 100 +, 10 +k 7 +. 3 +I 13 +7 +ACM International Collegiate Programming Contest (abbreviated +as ACM-ICPC or just ICPC) is an annual multi-tiered competition +among the universities of the world. The ICPC challenges students +to set ever higher standards of excellence for themselves +through competition that rewards team work, problem analysis, +and rapid software development. +From Wikipedia. +Sample Output +3.74$*/ +//https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2315 import static java.lang.Integer.parseInt; import static java.lang.System.exit; @@ -13,7 +48,6 @@ import java.util.Scanner; import java.util.StringTokenizer; -//https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2315 public class Newspaper { static void solve() throws Exception {