Last active
December 27, 2015 19:39
-
-
Save IuryAlves/7378709 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <map> | |
| #include <utility> | |
| using namespace std; | |
| /* dado usa sequencia de caracteres numericos imprime quantos leds serão preciso para mostrar os caracteres | |
| é utilizado a entrada e saída padrão | |
| */ | |
| int main(){ | |
| map<char,int> leds; | |
| int n,i,j,result = 0; | |
| string valor; | |
| leds.insert(pair<char, int>('0',6)); | |
| leds.insert(pair<char, int>('1',2)); | |
| leds.insert(pair<char, int>('2',5)); | |
| leds.insert(pair<char, int>('3',5)); | |
| leds.insert(pair<char, int>('4',4)); | |
| leds.insert(pair<char, int>('5',5)); | |
| leds.insert(pair<char, int>('6',6)); | |
| leds.insert(pair<char, int>('7',4)); | |
| leds.insert(pair<char, int>('8',7)); | |
| leds.insert(pair<char, int>('9',6)); | |
| map<char, int>::iterator iter; | |
| while(cin >> n){ | |
| for(j = 0; j <= n; j++){ | |
| getline(cin,valor); | |
| for(i = 0; i < valor.size(); i++){ | |
| iter = leds.find(valor[i]); | |
| result += iter->second; | |
| } | |
| cout << result << '\n'; | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment