# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
34591 | 2017-11-14T05:35:52 Z | 5ak0 | 고장난 휴대전화기 (COCI14_mobitel) | C++14 | 0 ms | 2180 KB |
/* ID: 5ak0 PROG: LANG: C++11 */ #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mpr make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 7; int x; map <int, int> mp; map <char, string> s; string str; int main(){ #ifndef SAKO //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); #endif // SAKO ios_base::sync_with_stdio(0); for (int i = 1; i <= 9; ++i){ cin >> x; mp[x] = i; } s['a'] = "2"; s['b'] = "22"; s['c'] = "222"; s['d'] = "3"; s['e'] = "33"; s['f'] = "333"; s['g'] = "4"; s['h'] = "44"; s['i'] = "444"; s['j'] = "5"; s['k'] = "55"; s['l'] = "555"; s['m'] = "6"; s['n'] = "66"; s['o'] = "666"; s['p'] = "7"; s['q'] = "77"; s['r'] = "777"; s['s'] = "7777"; s['t'] = "8"; s['u'] = "88"; s['v'] = "888"; s['w'] = "9"; s['x'] = "99"; s['y'] = "999"; s['z'] = "9999"; cin >> str; for (int i = 0; i < str.size(); ++i){ if (i > 0) if (s[str[i - 1]][0] == s[str[i]][0]) cout << "#"; for (int j = 0; j < s[str[i]].size(); ++j) cout << mp[s[str[i]][0] - '0']; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Correct | 0 ms | 2180 KB | Output is correct |
5 | Correct | 0 ms | 2180 KB | Output is correct |
6 | Correct | 0 ms | 2180 KB | Output is correct |
7 | Correct | 0 ms | 2180 KB | Output is correct |
8 | Correct | 0 ms | 2180 KB | Output is correct |
9 | Correct | 0 ms | 2180 KB | Output is correct |
10 | Correct | 0 ms | 2180 KB | Output is correct |