Submission #115704

#TimeUsernameProblemLanguageResultExecution timeMemory
115704luciocfAron (COCI17_aron)C++14
50 / 50
4 ms384 KiB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 30;

char a[maxn];

int main(void)
{
	int n;
	scanf("%d", &n);

	char ant = '*';
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		char c;
		scanf(" %c", &c);

		if (c != ant) ans++;

		ant = c;
	}

	printf("%d\n", ans+1);
}

Compilation message (stderr)

aron.cpp: In function 'int main()':
aron.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
aron.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c", &c);
   ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...