Submission #157562

#TimeUsernameProblemLanguageResultExecution timeMemory
157562dcjElder (COCI19_elder)C++14
0 / 50
2 ms376 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...