# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
931401 | AtinaR | Mobitel (COCI14_mobitel) | C++14 | 1 ms | 436 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
map<char,string> mapa;
string f(int num)
{
if(num==1)return "";
if(num==2)return "abc";
else if(num==3)return "def";
else if(num==4)return "ghi";
else if(num==5)return "jkl";
else if(num==6)return "mno";
else if(num==7)return "pqrs";
else if(num==8)return "tuv";
else if(num==9)return "wxyz";
}
int main()
{
int niza[9];
for(int i=0; i<9; i++)
{
cin>>niza[i];
}
string s;
cin>>s;
for(int i=0; i<9; i++)
{
int act_as=niza[i];
string keys=f(act_as);
int cnt=1;
for(auto x:keys)
{
string tmp="";
for(int k=0; k<cnt; k++)tmp+=(i+1)+'0';
mapa[x]=tmp;
cnt++;
}
}
for(int i=0; i<s.size(); i++)
{
cout<<mapa[s[i]];
if(i<s.size()-1)
{
if(mapa[s[i]][0]==mapa[s[i+1]][0])cout<<"#";
}
}
cout<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |