結果

問題 No.2460 #強調#
コンテスト
ユーザー 👑 Nachia
提出日時 2021-05-28 18:18:32
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 829 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,765 ms
コンパイル使用メモリ 255,264 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-20 15:32:48
合計ジャッジ時間 9,748 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:80: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
   28 |       ensuref(ChList.find(S[i]) != string::npos, "FAIL Condition failed: \" S[%d] is a invalid char.\"");
      |                                                                               ~^
      |                                                                                |
      |                                                                                int

ソースコード

diff #
raw source code

///////////////////////////////
//
//  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