URI Solution 1261 Hay Points | Data Structures
URI Online Judge Solution 1261 Hay Points | Data structures
URI Main Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1261
Problem Name: URI Problem
Problem Number : URI Problem 1261 Hay Points Solution
Online Judge : URI Online Judge Solution
Level: Data structures
Solution Language : C, C plus plus
URI Solution 1261 Hay Points Code in CPP:
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <map> #define SC1(a) scanf("%d", &a) #define SC2(a, b) scanf("%d %d", &a, &b) #define FOR(i, n) for(int i = 0; i < (n); ++i) using namespace std; typedef map<string, int> MI; MI mapa; int main(int argc, char const *argv[]) { int m, n, v, s; string w; while(SC2(m, n) == 2) { FOR(i, m) { cin >> w >> v; mapa[w] = v; } FOR(i, n) { s = 0; while(cin >> w && w.compare(".") != 0) s += mapa[w]; printf("%d\n", s); } } }
Tag: Uri solve 1261 Hay Points , Uri solution 1261 Hay Points , URI oj Solve 1261 Hay Points
No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks