제출 #584016

#제출 시각아이디문제언어결과실행 시간메모리
584016dhanunjay14Miners (IOI07_miners)C++14
0 / 100
165 ms724 KiB
#include <iostream> #include<cmath> #include<set> using namespace std; int distinct(char a, char b, char c){ set<char> dis; dis.insert(a); dis.insert(b); dis.insert(c); cout<<dis.size()<<endl; return dis.size(); } int main() { int n; cin>>n; string s; cin>>s; int c = 0; for(int i=0;i<s.length();i++){ if(i==0) c += 1; else if(i==1) { if(s[1]==s[0]) c += 1; else c += 2; } else c += distinct(s[i],s[i-1],s[i-2]); } cout<<c; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

miners.cpp: In function 'int main()':
miners.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0;i<s.length();i++){
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...