Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd4195d

Browse files
Merge pull request #5 from AnneLivia/main
added a new problem solved from uri, id is 1261
2 parents 5bb7a72 + bed96b6 commit bd4195d

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

‎Online Judges/URI/1261.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <iostream>
2+
#include <map>
3+
4+
using namespace std;
5+
6+
int main() {
7+
8+
int m, n, price;
9+
string cargo, description;
10+
cin >> m >> n;
11+
map<string, int> haypoint;
12+
13+
while(m--) {
14+
cin >> cargo;
15+
cin >> haypoint[cargo];
16+
}
17+
18+
// reading the description of the job
19+
while(n--) {
20+
price = 0;
21+
description = "";
22+
while(description != ".") {
23+
cin >> description; // reading word by word
24+
if(haypoint.find(description) != haypoint.end()) {
25+
// existe, só somar
26+
price+=haypoint[description];
27+
}
28+
}
29+
30+
cout << price << endl;
31+
}
32+
return 0;
33+
}

‎Online Judges/URI/1261.exe

112 KB
Binary file not shown.

‎Online Judges/URI/1261.o

103 KB
Binary file not shown.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /