# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
758115 | 2023-06-14T07:42:05 Z | KN200711 | 고장난 휴대전화기 (COCI14_mobitel) | C++14 | 1 ms | 316 KB |
# include <bits/stdc++.h> # define ll long long using namespace std; int pos[10]; int val(char a) { int x = a - 'a'; x /= 3; x += 2; if(a == 'p' || a == 'q' || a == 'r' || a == 's') return 7; if(a == 't' || a == 'u' || a == 'v') return 8; if(a == 'w' || a == 'x' || a == 'y' || a == 'z') return 9; return x; } int ch(char a) { int x = a - 'a'; // cout<<x<<endl; x %= 3; x++; if(a == 'p' || a == 't' || a == 'w') return 1; if(a == 'q' || a == 'u' || a == 'x') return 2; if(a == 'r' || a == 'v' || a == 'y') return 3; if(a == 's' || a == 'z') return 4; return x; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); for(int i=1;i<=9;i++) { int a; cin>>a; pos[a] = i; } string S; cin>>S; for(int i=0;i<S.length();i++) { if(i > 0 && val(S[i - 1]) == val(S[i])) { cout<<"#"; } for(int d=0;d<ch(S[i]);d++) cout<<pos[val(S[i])]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 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 | 0 ms | 316 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 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 |