Submission #28186949
Source Code Expand
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,k,n) for (int i = (k); i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
// using P = pair<ll,ll>;
const ll INF = (ll)1e18;
// const int INF = (int)1e9+7;
// const int MOD = (int)1e9+7;
// const ll MOD = (int)1e9+7;
template<typename T>
void chmin(T &a, T b) { a = min(a, b); }
template<typename T>
void chmax(T &a, T b) { a = max(a, b); }
template<typename T>
void print(vector<T> v) {
int n = v.size();
rep(i,n) {
if (i == 0) cout << v[i];
else cout << ' ' << v[i];
}
cout << endl;
}
void solve() {
string s;
cin >> s;
reverse(all(s));
int n = s.size();
int sum = 0;
rep(i,n) sum += s[i]-'0';
string ans = "";
int carry = 0;
rep(i,n) {
ans.push_back('0' + (carry+sum)%10);
carry = (carry+sum) / 10;
sum -= (s[i]-'0');
}
while (carry > 0) {
ans.push_back('0' + carry%10);
carry /= 10;
}
reverse(all(ans));
cout << ans << endl;
}
int main() {
solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Σ[k=0..10^100]floor(X/10^k) |
| User | goropikari |
| Language | C++ (GCC 9.2.1) |
| Score | 500 |
| Code Size | 1259 Byte |
| Status | AC |
| Exec Time | 24 ms |
| Memory | 5348 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| hand_01.txt | AC | 8 ms | 3420 KiB |
| hand_02.txt | AC | 21 ms | 5288 KiB |
| hand_03.txt | AC | 4 ms | 3500 KiB |
| hand_04.txt | AC | 19 ms | 5244 KiB |
| sample_01.txt | AC | 5 ms | 3636 KiB |
| sample_02.txt | AC | 2 ms | 3496 KiB |
| sample_03.txt | AC | 2 ms | 3636 KiB |
| test_01.txt | AC | 2 ms | 3628 KiB |
| test_02.txt | AC | 19 ms | 4200 KiB |
| test_03.txt | AC | 13 ms | 4176 KiB |
| test_04.txt | AC | 15 ms | 4312 KiB |
| test_05.txt | AC | 22 ms | 4476 KiB |
| test_06.txt | AC | 19 ms | 4464 KiB |
| test_07.txt | AC | 8 ms | 3708 KiB |
| test_08.txt | AC | 6 ms | 3732 KiB |
| test_09.txt | AC | 18 ms | 5232 KiB |
| test_10.txt | AC | 24 ms | 5252 KiB |
| test_11.txt | AC | 17 ms | 5288 KiB |
| test_12.txt | AC | 17 ms | 5348 KiB |