문제 링크 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14mbSaAEwCFAYD
문제의 저작권은 SW Expert Academy에 있습니다.
#include <iostream> #include <stack> using namespace std; int main(void) { int length; char temp; string input; for(int t_case=0; t_case<10; t_case++) { string postfix = ""; cin >> length; cin >> input; for(int i=0; i<length; i++) { if(input.at(i) == '+') { postfix += input.at(++i); postfix += '+'; } else { postfix += input.at(i); } } int answer = 0; for(int i=0; i<length; i++) { if(postfix.at(i) != '+') answer += (postfix.at(i) - '0'); } cout << "#" << t_case+1 << " " << answer << "\n"; } return 0; } | cs |
'C & C++ > SW Expert Academy' 카테고리의 다른 글
SWEA 1768 - [SW Test 샘플문제] 숫자야구게임 (0) | 2018.04.28 |
---|---|
SWEA 3499 - 퍼펙트 셔플 (0) | 2018.04.28 |
SWEA 1231 - [S/W 문제해결 기본] 9일차 중위순회 (0) | 2018.04.28 |
SWEA 1232 - [S/W 문제해결 기본] 9일차 사칙연산 (0) | 2018.04.28 |
SWEA 3314 - 보충학습과 평균 (0) | 2018.04.28 |