結果

問題 No.2460 #強調#
ユーザー 👑 NachiaNachia
提出日時 2021-05-28 18:18:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 5,526 ms
コンパイル使用メモリ 210,588 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 21:15:31
合計ジャッジ時間 6,815 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

///////////////////////////////
//
//  Validator
//

#include "testlib.h"
#include <iostream>
#include <string>
using namespace std;
using ll = long long;
using ull = unsigned long long;

const string ChList = "abcdefghijklmnopqrstuvwxyz";
const char MarkChar = '#';

string S;

int main() {
  registerValidation();

  S = inf.readToken();
  ensure(2 <= S.size() && S.size() <= 100);
  int markCount = 0;
  for(int i=0; i<S.size(); i++){
    if(S[i] == MarkChar) markCount++;
    else{
      ensuref(ChList.find(S[i]) != string::npos, "FAIL Condition failed: \" S[%d] is a invalid char.\"");
    }
  }
  ensure(markCount == 2);
  inf.readEoln();
  inf.readEof();

  int lMark = (int)S.find('#');
  int rMark = (int)S.find('#',lMark+1);
  string ans = S.substr(lMark+1,rMark-lMark-1);
  printf("%s\n",ans.c_str());
  return 0;
}
0