# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
201303 | 2020-02-10T07:12:56 Z | ArKCa | 고장난 휴대전화기 (COCI14_mobitel) | C++17 | 6 ms | 504 KB |
#include<bits/stdc++.h> #define f1 first #define s2 second #define pb push_back #define pob pop_back #define int ll #define ll long long #define PII pair<int,int> #define N 11 using namespace std; int n,a,last,b; int dizi[N]; string s; int calc(char c){ if( c=='a' || c=='b' || c=='c' )return 2; if( c=='d' || c=='e' || c=='f' )return 3; if( c=='g' || c=='h' || c=='i' )return 4; if( c=='j' || c=='k' || c=='l' )return 5; if( c=='m' || c=='n' || c=='o' )return 6; if( c=='t' || c=='u' || c=='v' )return 8; if( c=='p' || c=='q' || c=='r' || c=='s' )return 7; if( c=='w' || c=='x' || c=='y' || c=='z' )return 9; } int calc1(char c){ if( c=='a' || c=='d' || c=='g' || c=='j' || c=='m' || c=='t' || c=='p' || c=='w' )return 1; if( c=='b' || c=='e' || c=='h' || c=='k' || c=='n' || c=='u' || c=='q' || c=='x' )return 2; if( c=='c' || c=='f' || c=='i' || c=='l' || c=='o' || c=='v' || c=='r' || c=='y' )return 3; if( c=='s' || c=='z' )return 4; } int32_t main(){ // freopen("a.gir","r",stdin); // freopen("a.cik","w",stdout); for(int i=1;i<=9;i++){ scanf("%lld",&a); dizi[a]=i; } cin>>s; for(int i=0;i<s.size();i++){ a=calc(s[i]); b=calc1(s[i]); if(a==last) printf("#"); while(b--) printf("%lld",dizi[a] ); last=a; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 6 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 6 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |