結果

問題 No.1458 Segment Function
コンテスト
ユーザー a01sa01to
提出日時 2025-11-14 01:02:46
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 3,032 ms
コンパイル使用メモリ 279,704 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-11-14 01:02:51
合計ジャッジ時間 5,120 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  string p, n;
  cin >> p >> n;
  if (n.size() >= 2) n = "10";
  rep(_, stoi(n)) {
    ll nxt = 0;
    for (char c : p) {
      if (c == '-') nxt += 1;
      if (c == '0') nxt += 6;
      if (c == '1') nxt += 2;
      if (c == '2') nxt += 5;
      if (c == '3') nxt += 5;
      if (c == '4') nxt += 4;
      if (c == '5') nxt += 5;
      if (c == '6') nxt += 6;
      if (c == '7') nxt += 4;
      if (c == '8') nxt += 7;
      if (c == '9') nxt += 6;
    }
    p = to_string(nxt);
  }
  cout << p << '\n';
  return 0;
}
0