Submission #40079

#TimeUsernameProblemLanguageResultExecution timeMemory
40079HebisukeAron (COCI17_aron)C++14
50 / 50
0 ms1116 KiB
#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 (stderr)

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);
                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...