結果
問題 | No.9011 数字を全て足そう(数字だけ) |
ユーザー | o2o9 |
提出日時 | 2024-08-12 05:19:18 |
言語 | C++17(clang) (17.0.6 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 6,199 bytes |
コンパイル時間 | 4,137 ms |
コンパイル使用メモリ | 180,608 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-12 05:19:23 |
合計ジャッジ時間 | 5,253 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,940 KB |
testcase_11 | AC | 2 ms
6,944 KB |
testcase_12 | AC | 2 ms
6,944 KB |
testcase_13 | AC | 2 ms
6,940 KB |
testcase_14 | AC | 2 ms
6,940 KB |
testcase_15 | AC | 1 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,944 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 2 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,940 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,940 KB |
コンパイルメッセージ
main.cpp:251:4: warning: expression result unused [-Wunused-value] 251 | (cout << ... << (cout << ' ', b)); | ^~~~ main.cpp:268:3: note: in instantiation of function template specialization 'print<int>' requested here 268 | print(solve(s)); | ^ 1 warning generated.
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; const int INF = 1e9; const long long LINF = 1e18; const int dx[] = {1,0,-1,0}; const int dy[] = {0,1,0,-1}; #define ll long long #define uint unsigned int #define ull unsigned long long #define vint vector<int> #define vll vector<long long> #define pint pair<int,int> #define pb push_back #define mp make_pair #define elif else if #define sum(...) accumulate(ALL(__VA_ARGS__),0LL) #define REP1(i,n) for (int i = 0; i < (n); i++) #define REP2(i,a,b) for (int i = (a); i < (b); i++) #define REP3(i,a,b,c) for (int i = (a); i < (b); i += (c)) #define LREP(i,a,b) for (ll i = (a); i < (b); i++) #define DREP(i,n) for (int i = n - 1; i--;) #define drep(i,cc,n) for (int i = (cc); i <= (n); i++) #define rep(i,n) drep(i,0,n-1) #define sz(s) (int)(s.size()) #define EACH(x,a) for (auto& (x) : (a)) #define ENDL cout << endl; #define ALL(x) (x).begin(),(x).end() #define RALL(x) (x).rbegin(),(x).rend() #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl; #define yes(n) cout << ((n) ? "Yes" : "No" ) << endl; #define INT(...) int __VA_ARGS__; input(__VA_ARGS__) #define LL(...) long long __VA_ARGS__; input(__VA_ARGS__) #define STR(...) string __VA_ARGS__; input(__VA_ARGS__) #define ULL(...) unsigned long long __VA_ARGS__; input(__VA_ARGS__) #define CH(...) char __VA_ARGS__; input(__VA_ARGS__) #define DB(...) double __VA_ARGS__; input(__VA_ARGS__) #define VINT(name, n) vector<int> name; input_array(n, name) #define VLL(name, n) vector<long long> name; input_array(n, name) #define VST(name, n) vector<string> name; input_array(n,name) #define overload3(a,b,c,d,e, ...) e #define REP(...) overload3(__VA_ARGS__, REP3,REP2,REP1)(__VA_ARGS__) #define init_1(x) memset(x,-1,sizeof (x)) #define init0(x) memset(x,0,sizeof (x)) #define init1(x) memset(x,1,sizeof (x)) inline void out() { putchar(' '); } inline void out(const bool &a) { printf("%d\n",a); } inline void out(const int &a) { printf("%d\n",a); } inline void out(const long long &a) { printf("%lld\n",a); } inline void out(const unsigned long long &a) { printf("%llu\n",a); } inline void out(const char &a) { printf("%c\n",a); } inline void out(const char a[]) { printf("%s\n",a); } inline void out(const float &a) { printf("%.10f\n",a); } inline void out(const double &a) { printf("%.10f\n",a); } inline void out(const long double &a) { printf("%.10Lf\n", a); } // debug /* #define _GLIBCXX_DEBUG */ void debug_out() { cout << endl; } template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); } #ifdef _DEBUG #define debug(...) debug_out(__VA_ARGS__); #else #define debug(...) #endif template<class T> bool chmin(T& a, const T& b) { return b<a?a=b, 1:0; } template<class T> bool chmax(T& a, const T& b) { return b>a?a=b, 1:0; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (int i = 0; i < (int)v.size(); i++) { os << v[i] << (i + 1 != (int)v.size() ? " " : ""); } return os; } template <typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { for (int i = 0; i < (int)v.size(); i++) { os << v[i] << endl; } return os; } template <typename T> ostream &operator<<(ostream &os, const vector<vector<vector<T>>> &v) { for (int i = 0; i < (int)v.size(); i++) { os << "i = " << i << endl; os << v[i]; } return os; } template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; } template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp) { for (auto &[key, val] : mp) { os << key << ":" << val << " "; } return os; } template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; } template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; } template <typename T> ostream &operator<<(ostream &os, queue<T> q) { while (q.size()) { os << q.front() << " "; q.pop(); } return os; } template <typename T> ostream &operator<<(ostream &os, deque<T> q) { while (q.size()) { os << q.front() << " "; q.pop_front(); } return os; } template <typename T> ostream &operator<<(ostream &os, stack<T> st) { while (st.size()) { os << st.top() << " "; st.pop(); } return os; } template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (pq.size()) { os << pq.top() << " "; pq.pop(); } return os; } using mint = modint998244353; //* using mint = modint1000000007; ostream &operator<<(ostream &os, const mint &i) { os << i.val(); return os; } ostream &operator<<(ostream &os, const vector<mint> &v) { for (int i = 0; i < (int)v.size(); i++) { os << v[i].val() << (i + 1 != (int)v.size() ? " " : ""); } return os; } template <class... T> constexpr auto min(T... a) { return min(initializer_list<common_type_t<T...>>{a...}); } template<class... T> void input(T&... a) { (cin >> ... >> a); } template<typename T> void input_array(const int n, vector<T>& vec) { vec.resize(n); for (T& x : vec) { cin >> x; } } void print() { cout << '\n'; } template <typename T, class... Ts> void print(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; } int solve(string s) { int sum = 0; REP(i,sz(s)) { int a = s[i] - '0'; sum += a; } return sum; } int main() { ios::sync_with_stdio(false); cin.tie(0); STR(s); print(solve(s)); return 0; }