답안 #97874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97874 2019-02-19T09:02:58 Z AKaan37 Aron (COCI17_aron) C++14
50 / 50
3 ms 512 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)

const int inf = 1000000000;
const int mod = 1000000007;
const int KOK = 100000;
const int li = 100005;
const int LOG = 20;

int n,m,cev,x,k;
vector<int> v;
char c;
string s;

int main(){
	scanf("%d",&n);
	FOR{
		char cc;
		scanf(" %c",&c);
		if(c==cc) continue;
		cev++;
		cc=c;
	}
	printf("%d\n",cev+1);
	return 0;
}

Compilation message

aron.cpp: In function 'int main()':
aron.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
aron.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c",&c);
   ~~~~~^~~~~~~~~~
aron.cpp:31:3: warning: 'cc' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(c==cc) continue;
   ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 3 ms 412 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct