답안 #40079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40079 2018-01-26T12:58:32 Z Hebisuke Aron (COCI17_aron) C++14
50 / 50
0 ms 1116 KB
#include "stdio.h"
int n,i,c=0;
char w[2],old[2];
main()
{
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%s",w);
        if(i==1)
        {
            old[0]=w[0];
            c++;
        }
        else if(w[0]!=old[0])
        {
            c++;
            old[0]=w[0];
        }
    }
    printf("%d",c+1);
}

Compilation message

aron.cpp:4:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
aron.cpp: In function 'int main()':
aron.cpp:6:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
aron.cpp:9:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",w);
                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 0 ms 1116 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 0 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
8 Correct 0 ms 1116 KB Output is correct
9 Correct 0 ms 1116 KB Output is correct
10 Correct 0 ms 1116 KB Output is correct