結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー fumuumuffumuumuf
提出日時 2020-10-10 22:53:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,722 bytes
コンパイル時間 1,464 ms
コンパイル使用メモリ 165,028 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-27 22:42:49
合計ジャッジ時間 2,889 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
#define MOD 1000000007
#define MSG(a) cout << #a << " " << a << endl;
const int INF = 1e9;
template <class T, class C>
void chmax(T &a, C b)
{
  if (a <= b)
    a = b;
}
template <class T, class C>
void chmin(T &a, C b)
{
  if (a >= b)
    a = b;
}

// const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
// const int dx[]{0, 1, 0, -1}, dy[]{1, 0, -1, 0};

template <class T>
T sum(const vector<T> &v)
{
  T res = 0;
  for (size_t i = 0; i < v.size(); ++i)
    res += v[i];
  return res;
}

/////////////////////////////////////////////////////////
// print like python
// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed
/////////////////////////////////////////////////////////
void print()
{
  cout << endl;
}

template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail)
{
  cout << head;
  if (sizeof...(tail) != 0)
    cout << " ";
  print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec)
{
  for (auto &a : vec)
  {
    cout << a;
    if (&a != &vec.back())
      cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<vector<T>> &df)
{
  for (auto &vec : df)
  {
    print(vec);
  }
}
/////////////////////////////////////////////////////////

int main()
{
  //入力の高速化用のコード
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // std::cout << std::setprecision(15);
  //////////////////////////////////////////
  string s;
  cin >> s;
  int ans=0;
  rep(i,s.length()){
      ans+=s[i]-'0';
  }
  print(ans);

  // string a, b;
  // cin >> a >> b;
  return 0;
}
0