-
백준 5026번: 박사 과정문자열(String) 2018. 8. 5. 17:01반응형
https://www.acmicpc.net/problem/5026
1. 문제
2. 알고리즘
키워드 - 구현, 문자열
3. 코드
123456789101112131415161718192021222324252627282930313233343536373839404142434445#include <iostream>#include <sstream>#include <string>#include <algorithm>#include <functional>#include <vector>#include <list>#include <queue>#include <deque>#include <map>#include <set>#include <stack>#include <math.h>#include <memory.h>using namespace std;#define MAX_SIZE 100#define INF 0x7fffffff#define CENDL "\n"#define ll long longint main() {cin.tie(0);std::ios::sync_with_stdio(false);int n; cin >> n;while(n--) {string s; cin >> s;if (s == "P=NP") {cout << "skipped" << CENDL;continue;}int pos = s.find("+");string cand = s.substr(0, pos);int a = atoi(cand.c_str());cand.clear(); cand = s.substr(pos+1, s.size());int b = atoi(cand.c_str());cout << a + b << CENDL;}return 0;}cs 반응형'문자열(String)' 카테고리의 다른 글
백준 10174번: 팰린드롬 (0) 2018.08.05 백준 6996번: 애너그램 (0) 2018.08.05 백준 12605번: 단어순서 뒤집기 (0) 2018.08.04 백준 12780번: 원피스 (0) 2018.08.03 백준 9324번: 진짜 메시지 (0) 2018.07.31