# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
308780 | Doda | 고장난 휴대전화기 (COCI14_mobitel) | C++17 | 1 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define pb push_back
#define fr(n) for (int i = 0; i<n;i++)
typedef long long ll;
using namespace std;
ll pot (ll q, ll w){
ll qw = 1;
for (ll i = 0; i<w; i++)
qw*= q;
return qw;
}
int v[10];
string rijec,rj;
map <char,string> slova;
int main () {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
for (int i = 1; i<=9;i++){
int a;
cin >> a;
v[i] = a;
}
cin >> rijec;
slova['a']="2";
slova['b']="22";
slova['c']="222";
slova['d']="3";
slova['e']="33";
slova['f']="333";
slova['g']="4";
slova['h']="44";
slova['i']="444";
slova['j']="5";
slova['k']="55";
slova['l']="555";
slova['m']="6";
slova['n']="66";
slova['o']="666";
slova['p']="7";
slova['q']="77";
slova['r']="777";
slova['s']="7777";
slova['t']="8";
slova['u']="88";
slova['v']="888";
slova['w']="9";
slova['x']="99";
slova['y']="999";
slova['z']="9999";
fr(rijec.size()){
char a = rijec[i];
string s = slova[a];
int l = s.size();
char br= s[0];
int broj = int(br)-int('0');
int nbr;
for (int j = 1;j<10;j++)
if (v[j] == broj)
nbr = j;
// int nbr = v[broj];
nbr += int('0');
br = static_cast<char>(nbr);
int len = rj.size();
if (rj[len-1] == br)
rj+='#';
for (int j = 0;j<l;j++)
rj+=br;
}
cout << rj;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |