A - Treasure Chest 解説 by TKTY1


 find,rfind関数を用いることもできます.

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  if(s.find('|')<s.find('*')&&s.find('*')<s.rfind('|'))cout<<"in"<<endl;
  else cout<<"out"<<endl;
}

投稿日時:
最終更新: