結果

問題 No.3035 文字列のみの反転
ユーザー rrrriki
提出日時 2025-04-01 01:34:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,909 bytes
コンパイル時間 4,077 ms
コンパイル使用メモリ 279,680 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-04-01 01:34:35
合計ジャッジ時間 3,932 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *    author:  rrrriki
 *    created: 01.04.2025 01:31:02
 */
//#define USE_ACL
//#define USE_BOOST
#if !__INCLUDE_LEVEL__
#include <bits/stdc++.h>
#include __FILE__

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  stack<char> st;
  while (s.size()) {
    if (isdigit(s.back())) {
      st.push(s.back());
      s.pop_back();
    } else {
      break;
    }
  }
  reverse(ALL(s));
  cout << s;
  while (st.size()) {
    cout << st.top();
    st.pop();
  }
  cout << endl;
  return 0;
}

#else

// clang-format off
#ifdef USE_ACL
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
//using mint = modint1000000007;
#endif
#ifdef USE_BOOST
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/dynamic_bitset.hpp>
#include <boost/integer/extended_euclidean.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
#endif
#define ALL(x) x.begin(), x.end()
#define YES cout << "Yes\n"
#define NO cout << "No\n"
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#endif
using ll = long long;

#endif

/*
 *******  神龜雖壽  *******
 *******  猶有竟時  *******
 *******  騰蛇乘霧  *******
 *******  終爲土灰  *******
 *******  老驥伏櫪  *******
 *******  志在千里  *******
 *******  烈士暮年  *******
 *******  壯心不已  *******
 *******  盈縮之期  *******
 *******  不但在天  *******
 *******  養怡之福  *******
 *******  可得永年  *******
 *******  幸甚至哉  *******
 *******  歌以詠志  *******
 */
0