結果
問題 | No.3035 文字列のみの反転 |
ユーザー |
![]() |
提出日時 | 2025-02-28 21:22:06 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 768 bytes |
コンパイル時間 | 3,098 ms |
コンパイル使用メモリ | 273,812 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-28 21:22:15 |
合計ジャッジ時間 | 3,753 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
In file included from /usr/include/c++/13/bits/stl_algobase.h:67, from /usr/include/c++/13/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from main.cpp:1: In member function ‘constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+(difference_type) const [with _Iterator = char*; _Container = std::__cxx11::basic_string<char>]’, inlined from ‘int main()’ at main.cpp:34:12: /usr/include/c++/13/bits/stl_iterator.h:1148:47: warning: ‘id’ may be used uninitialized [-Wmaybe-uninitialized] 1148 | { return __normal_iterator(_M_current + __n); } | ^~~ main.cpp: In function ‘int main()’: main.cpp:27:9: note: ‘id’ was declared here 27 | int id; | ^~
ソースコード
#include <bits/stdc++.h> using namespace std; #define For(i, a, b) for(int i = (a); i < (b); i++) #define rep(i, n) For(i, 0, n) #define rFor(i, a, b) for(int i = (a); i >= (b); i--) #define ALL(v) (v).begin(), (v).end() #define rALL(v) (v).rbegin(), (v).rend() using lint = long long; using ld = long double; int INF = 2000000000; lint LINF = 1000000000000000000; struct SetupIo { SetupIo() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } } setupio; int main() { string s; cin >> s; int id; rep(i, int(s.size())) { if ('0' <= s[i] && s[i] <= '9') { id = i; break; } } reverse(s.begin(), s.begin() + id); cout << s << "\n"; }