Submission #84389

# Submission time Handle Problem Language Result Execution time Memory
84389 2018-11-14T21:37:46 Z MatesV13 Mobitel (COCI14_mobitel) C++11
50 / 50
2 ms 636 KB
#include <bits/stdc++.h>
using namespace std;
long long in[10],a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,stari, novi;
string word;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
	for (int I=1;I<10;I++){
		cin >> in[I];
		if (in[I]==1) continue;
		else if (in[I]==2){
			a = I;
			b = I*11;
			c = I*111;
		}
		else if (in[I]==3){
			d = I;
			e = I*11;
			f = I * 111;
		}
		else if (in[I]==4){
			g = I;
			h = I * 11;
			i = I * 111;
		}
		else if (in[I]==5){
			j = I;
			k = I * 11;
			l = I * 111;
		}
		else if (in[I]==6){
			m = I;
			n = I * 11;
			o = I * 111;
		}
		else if (in[I]==7){
			p = I;
			q = I * 11;
			r = I * 111;
			s = I * 1111;
		}
		else if (in[I]==8){
			t = I;
			u = I * 11;
			v = I * 111;
		}
		else if (in[I]==9){
			w = I;
			x = I * 11;
			y = I * 111;
			z = I * 1111;
			
		}
	}
	cin >> word;
	for (int I=0; I< word.size();I++){
		if (word.at(I) == 'a') novi = a;
		else if (word.at(I) == 'b') novi = b;
		else if (word.at(I) == 'c') novi = c;
		else if (word.at(I) == 'd') novi = d;
		else if (word.at(I) == 'e') novi = e;
		else if (word.at(I) == 'f') novi = f;
		else if (word.at(I) == 'g') novi = g;
		else if (word.at(I) == 'h') novi = h;
		else if (word.at(I) == 'i') novi = i;
		else if (word.at(I) == 'j') novi = j;
		else if (word.at(I) == 'k') novi = k;
		else if (word.at(I) == 'l') novi = l;
		else if (word.at(I) == 'm') novi = m;
		else if (word.at(I) == 'n') novi = n;
		else if (word.at(I) == 'o') novi = o;
		else if (word.at(I) == 'p') novi = p;
		else if (word.at(I) == 'q') novi = q;
		else if (word.at(I) == 'r') novi = r;
		else if (word.at(I) == 's') novi = s;
		else if (word.at(I) == 't') novi = t;
		else if (word.at(I) == 'u') novi = u;
		else if (word.at(I) == 'v') novi = v;
		else if (word.at(I) == 'w') novi = w;
		else if (word.at(I) == 'x') novi = x;
		else if (word.at(I) == 'y') novi = y;
		else if (word.at(I) == 'z') novi = z;
		if (I>0 && stari % 10 == novi % 10){
		cout << "#";
		}
		cout << novi;
		stari = novi;
	}
return 0;
}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:56:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int I=0; I< word.size();I++){
                ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 448 KB Output is correct
4 Correct 2 ms 524 KB Output is correct
5 Correct 2 ms 524 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 616 KB Output is correct
8 Correct 2 ms 636 KB Output is correct
9 Correct 2 ms 636 KB Output is correct
10 Correct 2 ms 636 KB Output is correct