提出 #66096528
ソースコード 拡げる
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
cin >> s;
int n = s.size();
int nw = 0;
int ans = n;
for(int i=n-1;i>=0;i--){
int t = s[i] - '0';
while(nw > t) nw -= 10;
ans += t - nw;
nw = t;
}
cout << ans;
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Security 2 |
| ユーザ | WinterXorSnow |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 300 |
| コード長 | 272 Byte |
| 結果 | AC |
| 実行時間 | 9 ms |
| メモリ | 4380 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 3660 KiB |
| 00-sample-02.txt | AC | 1 ms | 3692 KiB |
| 00-sample-03.txt | AC | 1 ms | 3468 KiB |
| 01-01.txt | AC | 1 ms | 3504 KiB |
| 01-02.txt | AC | 1 ms | 3624 KiB |
| 01-03.txt | AC | 1 ms | 3480 KiB |
| 01-04.txt | AC | 1 ms | 3440 KiB |
| 01-05.txt | AC | 1 ms | 3508 KiB |
| 01-06.txt | AC | 1 ms | 3464 KiB |
| 01-07.txt | AC | 1 ms | 3496 KiB |
| 01-08.txt | AC | 1 ms | 3568 KiB |
| 01-09.txt | AC | 1 ms | 3584 KiB |
| 01-10.txt | AC | 2 ms | 3664 KiB |
| 01-11.txt | AC | 9 ms | 4208 KiB |
| 01-12.txt | AC | 9 ms | 4204 KiB |
| 01-13.txt | AC | 7 ms | 4212 KiB |
| 01-14.txt | AC | 7 ms | 4380 KiB |