#include <bits/stdc++.h>
using namespace std;
long long x,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,y,z,stari,x1,ix,novi;
string word;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
for (int I=1;I<10;I++){
cin >> x;
if (x==1) continue;
else if (x==2){
a = I;
b = I*11;
c = I*111;
}
else if (x==3){
d = I;
e = I * 11;
f = I * 111;
}
else if (x==4){
g = I;
h = I * 11;
ix = I * 111;
}
else if (x==5){
j = I;
k = I * 11;
l = I * 111;
}
else if (x==6){
m = I;
n = I * 11;
o = I * 111;
}
else if (x==7){
p = I;
q = I * 11;
r = I * 111;
s = I * 1111;
}
else if (x==8){
t = I;
u = I * 11;
v = I * 111;
}
else if (x==9){
w = I;
y = I * 111;
z = I * 1111;
x1 = I * 11;
}
}
cin >> word;
for (int i=0; i< word.size();i++){
if (word.at(i) == 'a') stari = a;
else if (word.at(i) == 'b') stari = b;
else if (word.at(i) == 'c') stari = c;
else if (word.at(i) == 'd') stari = d;
else if (word.at(i) == 'e') stari = e;
else if (word.at(i) == 'f') stari = f;
else if (word.at(i) == 'g') stari = g;
else if (word.at(i) == 'h') stari = h;
else if (word.at(i) == 'i') stari = ix;
else if (word.at(i) == 'j') stari = j;
else if (word.at(i) == 'k') stari = k;
else if (word.at(i) == 'l') stari = l;
else if (word.at(i) == 'm') stari = m;
else if (word.at(i) == 'n') stari = n;
else if (word.at(i) == 'o') stari = o;
else if (word.at(i) == 'p') stari = p;
else if (word.at(i) == 'q') stari = q;
else if (word.at(i) == 'r') stari = r;
else if (word.at(i) == 's') stari = s;
else if (word.at(i) == 't') stari = t;
else if (word.at(i) == 'u') stari = u;
else if (word.at(i) == 'v') stari = v;
else if (word.at(i) == 'w') stari = w;
else if (word.at(i) == 'x') stari = x1;
else if (word.at(i) == 'y') stari = y;
else if (word.at(i) == 'z') stari = z;
if (i>0 && stari % 10 == novi % 10) cout << "#";
cout << stari;
novi = stari;
}
return 0;
}
Compilation message
mobitel.cpp: In function 'int main()':
mobitel.cpp:55:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i< word.size();i++){
~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
288 KB |
Output is correct |
2 |
Correct |
2 ms |
372 KB |
Output is correct |
3 |
Correct |
2 ms |
464 KB |
Output is correct |
4 |
Correct |
2 ms |
516 KB |
Output is correct |
5 |
Correct |
2 ms |
564 KB |
Output is correct |
6 |
Correct |
2 ms |
628 KB |
Output is correct |
7 |
Correct |
2 ms |
652 KB |
Output is correct |
8 |
Correct |
2 ms |
656 KB |
Output is correct |
9 |
Correct |
2 ms |
700 KB |
Output is correct |
10 |
Correct |
2 ms |
748 KB |
Output is correct |