제출 #1164385

#제출 시각아이디문제언어결과실행 시간메모리
1164385glupan고장난 휴대전화기 (COCI14_mobitel)C++20
50 / 50
0 ms328 KiB
#include <bits/stdc++.h> #define div / #define ll long long #define fore(i, l, r) for(int i=int(l); i<int(r); i++) using namespace std; const int INF = 1e9; const int MX = 5e5 + 23; const int MOD = 1000000007; const int MAX_N = 5e5+23; const int N = 1e6; void solve() { int a[9]; for(int i=0; i<9; i++) cin >> a[i]; string s; cin >> s; int last=-1; for(int i=0; i<s.length(); i++) { int keypad; if((s[i]-'a') < 15) keypad = (s[i]-'a')/3; else if((s[i]-'a') < 19) keypad = 5; else if((s[i]-'a') < 22) keypad = 6; else keypad = 7; keypad+=2; for(int j=0; j<9; j++) { if(a[j] == keypad) { if(last == j+1) cout << '#'; last = j+1; if(keypad == 7 || keypad == 9) { if(keypad == 7) { for(int g=0; g<=(s[i]-'a')-15; g++) cout << j+1; } else { for(int g=0; g<=(s[i]-'a')-22; g++) cout << j+1; } } else { int tmp; if((s[i]-'a') < 15) tmp=(s[i]-'a')%3; else tmp = (s[i]-'a')-19; for(int g=0; g<=tmp; g++) cout << j+1; } } } } cout << endl; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int t=1; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...