Submission #157562

# Submission time Handle Problem Language Result Execution time Memory
157562 2019-10-12T12:54:38 Z dcj Elder (COCI19_elder) C++14
0 / 50
2 ms 376 KB
#include <iostream>

using namespace std;


int main()
{
	char Z1, Z2, p;
	int N, br=1,u;
	cin >> p;
	cin >> N;
	int v[28];
	v[(int)p - 'A'] = 1;
	for (int i=1; i<=N;i++) {
		scanf("%c %c", Z1, Z2);
		if (Z2==p) {
			v[(int)Z1 - 'A']=1;
			p=Z1;
		}
	}
	for (int i=0;i<=26;i++) {
		if (v[i]==1)
			br++;
	}
	cout << p;
	cout << br;
	return 0;
}

Compilation message

elder.cpp: In function 'int main()':
elder.cpp:15:24: warning: format '%c' expects argument of type 'char*', but argument 2 has type 'int' [-Wformat=]
   scanf("%c %c", Z1, Z2);
                        ^
elder.cpp:15:24: warning: format '%c' expects argument of type 'char*', but argument 3 has type 'int' [-Wformat=]
elder.cpp:9:14: warning: unused variable 'u' [-Wunused-variable]
  int N, br=1,u;
              ^
elder.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%c %c", Z1, Z2);
   ~~~~~^~~~~~~~~~~~~~~~~
elder.cpp:15:8: warning: 'Z2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   scanf("%c %c", Z1, Z2);
   ~~~~~^~~~~~~~~~~~~~~~~
elder.cpp:15:8: warning: 'Z1' may be used uninitialized in this function [-Wmaybe-uninitialized]
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Unexpected end of file - token expected
2 Incorrect 2 ms 376 KB Unexpected end of file - token expected
3 Incorrect 2 ms 252 KB Unexpected end of file - token expected
4 Incorrect 2 ms 256 KB Unexpected end of file - token expected
5 Incorrect 2 ms 256 KB Unexpected end of file - token expected
6 Incorrect 2 ms 376 KB Unexpected end of file - token expected
7 Incorrect 2 ms 256 KB Unexpected end of file - token expected
8 Incorrect 2 ms 256 KB Unexpected end of file - token expected
9 Incorrect 2 ms 256 KB Unexpected end of file - token expected
10 Incorrect 2 ms 256 KB Unexpected end of file - token expected