結果
問題 | No.1458 Segment Function |
ユーザー |
|
提出日時 | 2021-03-31 21:48:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 919 bytes |
コンパイル時間 | 819 ms |
コンパイル使用メモリ | 98,576 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 13:35:32 |
合計ジャッジ時間 | 1,950 ms |
ジャッジサーバーID (参考情報) |
judge / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <iostream>#include <string>#include <algorithm>#include <vector>#include <iomanip>#include <cmath>#include <stdio.h>#include <queue>#include <deque>#include <cstdio>#include <set>#include <map>#include <bitset>#include <stack>#include <cctype>using namespace std;int f[11] = { 6,2,5,5,4,5,6,4,7,6 };int main() {string p, n;cin >> p >> n;if (n.size() < 6) {for (int j = 0; j < stoi(n); j++) {int co = 0;if (p[0] == '-') {co++;p = p.substr(1, p.size() - 1);}for (int i = 0; i < p.size(); i++) {co += f[int(p[i] - '0')];}p = to_string(co);}}else {for (int j = 0; j < 100000; j++) {int co = 0;if (p[0] == '-') {co++;p = p.substr(1, p.size() - 1);}for (int i = 0; i < p.size(); i++) {co += f[int(p[i] - '0')];}p = to_string(co);}cout << p << endl;return 0;}cout << p << endl;return 0;}