답안 #129241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129241 2019-07-11T21:53:22 Z 44442 Elder (COCI19_elder) C++11
50 / 50
2 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
char a[101],b[101],j;
bool v[204];
short n,d,e,ok=1,k;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
   cin>>j>>n;
   for(int i=0;i<n;i++){
   	    cin>>a[i]>>b[i]; 
   }
    for(d;d<n;d++){
	    if(b[d]==j){
          v[j]=1;
          j=a[d]; 
          ok=ok+!v[j]; 
     }
    }
    cout<<j<<endl<<ok;
return 0;
}

Compilation message

elder.cpp: In function 'int main()':
elder.cpp:13:10: warning: statement has no effect [-Wunused-value]
     for(d;d<n;d++){
          ^
elder.cpp:15:14: warning: array subscript has type 'char' [-Wchar-subscripts]
           v[j]=1;
              ^
elder.cpp:17:21: warning: array subscript has type 'char' [-Wchar-subscripts]
           ok=ok+!v[j]; 
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct