Submission #74100

# Submission time Handle Problem Language Result Execution time Memory
74100 2018-08-30T05:42:54 Z charlies_moo Tavan (COCI16_tavan) C++14
0 / 80
2 ms 852 KB
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

char letter[]={"0123456789ABCDEFGHIJKLHIMNOPQRSTUVWXYZ"};
string to;
int num;

void change(int x)
{
    if(x)
        change(x/num);
    to+=letter[x%num];
}

int main()
{
	string voc,c[505],ans;
	int n,m,k,x,count_=0;
	cin>>n>>m>>k>>x;
	cin>>voc;
	for(int i=0;i<m;i++)
		cin>>c[i];
	num=k+1;
	change(x);
	while(to.size()<m)
	{
		char zero='0';
		to.insert(0,"0");
	}
	for(int i=0;i<n;i++)
		if(voc[i]!='#')
			ans+=voc[i];
		else
		{
			if(to[count_]>='0' && to[count_]<='9')
				ans+=c[count_++][to[count_]-'0'];
			else
				ans+=c[count_++][to[count_]-'A'+10];
		}
	cout<<ans;
	return 0;
}

Compilation message

tavan.cpp: In function 'int main()':
tavan.cpp:28:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(to.size()<m)
        ~~~~~~~~~^~
tavan.cpp:30:8: warning: unused variable 'zero' [-Wunused-variable]
   char zero='0';
        ^~~~
tavan.cpp:39:18: warning: operation on 'count_' may be undefined [-Wsequence-point]
     ans+=c[count_++][to[count_]-'0'];
            ~~~~~~^~
tavan.cpp:41:18: warning: operation on 'count_' may be undefined [-Wsequence-point]
     ans+=c[count_++][to[count_]-'A'+10];
            ~~~~~~^~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Incorrect 2 ms 644 KB Output isn't correct
3 Incorrect 2 ms 644 KB Output isn't correct
4 Incorrect 2 ms 644 KB Output isn't correct
5 Incorrect 2 ms 724 KB Output isn't correct
6 Incorrect 2 ms 724 KB Output isn't correct
7 Incorrect 2 ms 728 KB Output isn't correct
8 Incorrect 2 ms 732 KB Output isn't correct
9 Incorrect 2 ms 852 KB Output isn't correct
10 Incorrect 2 ms 852 KB Output isn't correct