Submission #165924

#TimeUsernameProblemLanguageResultExecution timeMemory
165924itiamMobitel (COCI14_mobitel)C++11
50 / 50
3 ms376 KiB
#include <iostream> #include <algorithm> #include <cstdio> #include <string> #include <sstream> using namespace std; char La[26]={'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','7','8','8','8','9','9','9','9'}; int La2[26]={1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4}; int L[13]; int L3[1004]; int main(){ int y,brp; for (int i=1;i<10;i++){ cin >> y; L[i]=y; } string S,z; char prbr='*',a; cin >> S; int x=S.length(); for (int i=0;i<x;i++){ a=S[i]; brp=La2[(int)a-97]; if (prbr==La[(int)a-97]){ z+='#'; } else prbr=La[(int)a-97]; for (int j=0;j<brp;j++){ z+=La[(int)a-97]; } } char d; string L2[1004]; int e=z.length(); for (int i=1;i<=9;i++){ for (int j=0;j<e;j++){ string str= to_string(L[i]); string stri= to_string(i); if (z[j]==str[0] && L3[j]!=1){ L2[j]=stri; L3[j]=1; } else if (z[j]!=str[0] && L3[j]!=1){ L2[j]=z[j]; } } } for (int i=0;i<e;i++){ cout << L2[i]; } return 0; }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:35:10: warning: unused variable 'd' [-Wunused-variable]
     char d;
          ^
#Verdict Execution timeMemoryGrader output
Fetching results...