알고리즘 문제 풀이/1DP_과제(~180615)

180608_1076_저항

2018. 6. 8. 17:30

//https://www.acmicpc.net/problem/1076 #include <iostream>
#include <vector>
#include <string>
using namespace std;
struct res{
string color;
int value;
long long int digit;
};
res table[10];
void maketable(){
table[0].color="black"; table[0].value=0; table[0].digit=1;
table[1].color="brown"; table[1].value=1; table[1].digit=10;
table[2].color="red"; table[2].value=2; table[2].digit=100;
table[3].color="orange"; table[3].value=3; table[3].digit=1000;
table[4].color="yellow"; table[4].value=4; table[4].digit=10000;
table[5].color="green"; table[5].value=5; table[5].digit=100000;
table[6].color="blue"; table[6].value=6; table[6].digit=1000000;
table[7].color="violet"; table[7].value=7; table[7].digit=10000000;
table[8].color="grey"; table[8].value=8; table[8].digit=100000000;
table[9].color="white"; table[9].value=9; table[9].digit=1000000000;
return;
}
int main(){
maketable();
string color;
long long int ans=0;
cin >> color;
for(int i=0; i<10; i++){
if(table[i].color==color) {
ans=table[i].value;
break;
}
}
ans*=10;
cin >> color;
for(int i=0; i<10; i++){
if(table[i].color==color) {
ans+=table[i].value;
break;
}
}
cin >> color;
for(int i=0; i<10; i++){
if(table[i].color==color) {
ans*=table[i].digit;
break;
}
}
cout << ans;
return 0;
}


저작자표시 비영리 (새창열림)

'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글

180615_다음 큰 숫자  (0) 2018.06.15
180607_5597_과제안내신분?  (0) 2018.06.07
180604_10769_행복한지 슬픈지  (0) 2018.06.04
180602_4690_완전 세제곱  (0) 2018.06.02
180601_1934_최소공배수  (0) 2018.06.01
'알고리즘 문제 풀이/1DP_과제(~180615)' 카테고리의 다른 글
  • 180615_다음 큰 숫자
  • 180607_5597_과제안내신분?
  • 180604_10769_행복한지 슬픈지
  • 180602_4690_완전 세제곱
bong sue
bong sue
취업 준비하면서 공부하던 블로그인데, 이제 나이가 먹어가니까 사는 준비도 해야해서 이거저거 씁니다.
bong sue
수봉수봉 신변잡기
bong sue
전체
오늘
어제
  • 분류 전체보기 (268)
    • 알고리즘 문제 풀이 (264)
      • AtCoder 문제 풀기 (4)
      • 코딩 테스트 대비(~211220) (14)
      • 1DP_과제(~180615) (246)
    • Engineering (1)
      • 디자인패턴 (0)
      • 프로그래밍 언어론 (1)
    • 독서 (0)
      • 고전 읽기 프로젝트 (0)
      • 재테크 (0)
    • 내 집 마련 (단기 프로젝트) (0)

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

공지사항

인기 글

태그

  • 탐욕알고리즘
  • 브루트포스
  • 삼성
  • 1032
  • AtCoder
  • dp
  • ABC
  • 정렬
  • C언어
  • 그리디알고리즘
  • sort
  • Olympiad
  • 백준
  • 백준저지
  • 문자열처리
  • 알고스팟
  • 동적계획
  • bruteforce
  • Sea
  • 수학
  • dfs
  • 문자열
  • 구현
  • C++
  • 042
  • BFS
  • 탐색
  • 시뮬레이션
  • 브루트 포스
  • BOJ

최근 댓글

최근 글

hELLO · Designed By 정상우.
bong sue
180608_1076_저항
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.