Submission #115704

# Submission time Handle Problem Language Result Execution time Memory
115704 2019-06-08T17:40:52 Z luciocf Aron (COCI17_aron) C++14
50 / 50
4 ms 384 KB
#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

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 time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 3 ms 384 KB Output is correct