# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
714015 | 2023-03-23T14:11:05 Z | ALTAKEXE | 고장난 휴대전화기 (COCI14_mobitel) | C++14 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; int main() { vector<int> n(9); string s; int prev = 1; for (int i=0; i<9; i++) { int in; cin >> in; n[in-1] = i+1; } cin >> s; for (int i=0; i<s.length(); i++) { if (s[i]=='a') { if (prev==2) { cout << "#"; } cout << n[1]; prev=2; } else if (s[i]=='b') { if (prev==2) { cout << "#"; } cout << n[1] << n[1]; prev=2; } else if (s[i]=='c') { if (prev==2) { cout << "#"; } cout << n[1] << n[1] << n[1]; prev=2; } else if (s[i]=='d') { if (prev==3) { cout << "#"; } cout << n[2]; prev=3; } else if (s[i]=='e') { if (prev==3) { cout << "#"; } cout << n[2] << n[2]; prev=3; } else if (s[i]=='f') { if (prev==3) { cout << "#"; } cout << n[2] << n[2] << n[2]; prev=3; } else if (s[i]=='g') { if (prev==4) { cout << "#"; } cout << n[3]; prev=4; } else if (s[i]=='h') { if (prev==4) { cout << "#"; } cout << n[3] << n[3]; prev=4; } else if (s[i]=='i') { if (prev==4) { cout << "#"; } cout << n[3] << n[3] << n[3]; prev=4; } else if (s[i]=='j') { if (prev==5) { cout << "#"; } cout << n[4]; prev=5; } else if (s[i]=='k') { if (prev==5) { cout << "#"; } cout << n[4] << n[4]; prev=5; } else if (s[i]=='l') { if (prev==5) { cout << "#"; } cout << n[4] << n[4] << n[4]; prev=5; } else if (s[i]=='m') { if (prev==6) { cout << "#"; } cout << n[5]; prev=6; } else if (s[i]=='n') { if (prev==6) { cout << "#"; } cout << n[5] << n[5]; prev=6; } else if (s[i]=='o') { if (prev==6) { cout << "#"; } cout << n[5] << n[5] << n[5]; prev=6; } else if (s[i]=='p') { if (prev==7) { cout << "#"; } cout << n[6]; prev=7; } else if (s[i]=='q') { if (prev==7) { cout << "#"; } cout << n[6] << n[6]; prev=7; } else if (s[i]=='r') { if (prev==7) { cout << "#"; } cout << n[6] << n[6] << n[6]; prev=7; } else if (s[i]=='s') { if (prev==7) { cout << "#"; } cout << n[6] << n[6] << n[6] << n[6]; prev=7; } else if (s[i]=='t') { if (prev==8) { cout << "#"; } cout << n[7]; prev=8; } else if (s[i]=='u') { if (prev==8) { cout << "#"; } cout << n[7] << n[7]; prev=8; } else if (s[i]=='v') { if (prev==8) { cout << "#"; } cout << n[7] << n[7] << n[7]; prev=8; } else if (s[i]=='w') { if (prev==9) { cout << "#"; } cout << n[8]; prev=9; } else if (s[i]=='x') { if (prev==9) { cout << "#"; } cout << n[8] << n[8]; prev=9; } else if (s[i]=='y') { if (prev==9) { cout << "#"; } cout << n[8] << n[8] << n[8]; prev=9; } else if (s[i]=='z') { if (prev==9) { cout << "#"; } cout << n[8] << n[8] << n[8] << n[8]; prev=9; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |