summaryrefslogtreecommitdiff
path: root/11340
diff options
context:
space:
mode:
authorAditya Naik2018-05-10 14:17:45 -0400
committerAditya Naik2018-05-10 14:17:45 -0400
commit458fc02e1b2dd8c4434c90d0dcfdbaa5cc2e1fdb (patch)
tree1ffd274a0a72963f5effee7d74e9eda175181f2c /11340
parent893beff3693644ca99ae16aa505aac06f2733ab6 (diff)
newspaper
Diffstat (limited to '11340')
-rw-r--r--11340/newspaper.cpp32
-rw-r--r--11340/newspaper.in6
2 files changed, 38 insertions, 0 deletions
diff --git a/11340/newspaper.cpp b/11340/newspaper.cpp
new file mode 100644
index 0000000..9ffa848
--- /dev/null
+++ b/11340/newspaper.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+#include <string>
+#include <limits>
+using namespace std;
+
+int main(){
+ int tc;
+ cin>>tc;
+ for(int i=0; i<tc; i++){
+ int k, costmap[256]={0}, lines, cost;
+ double totcost=0;
+ char c, line[10000];
+
+ cin>>k;
+ for(int j=0; j<k; j++){
+ cin>>c>>cost;
+ costmap[c+128] = cost;
+ }
+
+ cin>>lines;
+ cin.ignore();
+ for(int j=0; j<lines; j++){
+ cin.get(line, 10000);
+ for(int l=0; line[l]!='\n' && line[l]!='\r'; l++){
+ totcost += costmap[line[l]+128];
+ }
+ }
+ cout.precision(2);
+ cout<<fixed<<totcost/100<<"$\n";
+ }
+ return 0;
+}
diff --git a/11340/newspaper.in b/11340/newspaper.in
new file mode 100644
index 0000000..4afe23e
--- /dev/null
+++ b/11340/newspaper.in
@@ -0,0 +1,6 @@
+1
+2
+y 20
+© 12
+1
+He yn thing rapid these after going drawn or. © \ No newline at end of file