Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 코딩
- vector
- coding
- 정석
- 오퍼레이팅시스템
- 컴공과
- 컴퓨터공학과
- 알고리즘
- 코테
- Computer science
- DP
- 자료구조
- OS
- 스택
- 그래프
- c++
- Stack
- 브루트포스
- 오에스
- 개발
- 백준
- 정석학술정보관
- Operating System
- 문제풀이
- bfs
- 북리뷰
- 구현
- cs
- 컴공
- 너비우선탐색
Archives
- Today
- Total
Little Jay
[C++] 백준 1076번 - 저항 본문
map을 사용해서 간단히 풀 수 있는 문제
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
map<string, int> d = {
{"black", 0},
{"brown", 1},
{"red", 2},
{"orange", 3},
{"yellow", 4},
{"green", 5},
{"blue", 6},
{"violet", 7},
{"grey", 8},
{"white", 9},
};
string s1, s2, s3;
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> s1 >> s2 >> s3;
long long ans = d[s1] * 10 + d[s2];
for (int i = 0; i < d[s3]; i++) {
ans *= 10;
}
cout << ans << endl;
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 9461번 - 파도반 수열 (0) | 2022.02.21 |
---|---|
[C++] 백준 1236 - 성지키기 (0) | 2022.02.19 |
[C++] 백준 6588번 - 골드바흐 추측 (0) | 2022.02.11 |
[C++] 백준 1744번 - 수 묶기 (0) | 2022.02.11 |
[C++] 백준 15312번 - 이름 궁합 (0) | 2022.02.06 |
Comments