Submission #3375244


Source Code Expand

int replace(int N,char *S){
  int i,j,p,c,k=0;
  string s = S;
  i=s.find("I");
  j=s.find("J");
  p=s.find("P");
  c=s.find("C");
  if(i<N&&i>j)j=s.find("J",i);
  if(j<N&&j>p)p=s.find("P",j);
  if(p<N&&p>c)c=s.find("C",p);
  k=(i==-1)+(j==-1)+(p==-1)+(c==-1);
  return k;
}

Submission Info

Submission Time
Task A - 国際情報オリンピック日本代表プログラミングコンテスト (Welcome to IJPC)
User yosswi414
Language IOI-Style C++ (GCC 5.4.1)
Score 0
Code Size 286 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int replace(int, char*)’:
./Main.cpp:3:3: error: ‘string’ was not declared in this scope
   string s = S;
   ^
./Main.cpp:3:10: error: expected ‘;’ before ‘s’
   string s = S;
          ^
./Main.cpp:4:5: error: ‘s’ was not declared in this scope
   i=s.find("I");
     ^
./grader.cpp: In function ‘int main()’:
./grader.cpp:10:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%s", &N, S);
                       ^