Submission #21099505


Source Code Expand

#include <bits/stdc++.h>
#define PI 3.14159265359
#define lp(i, n) for (size_t i = 0; i < n; i++)
typedef long long ll;
typedef long double ld;

using namespace std;

const char nl = '\n';

ll p(ll x, int e) {
    ll ret{1};
    for (int i = 0; i < e; i++)
        ret *= x;
    return ret;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int i;
    ll ret{};
    for (i = 2; i < s.size(); i += 2) {
        ret += 9 * p(10, i / 2 - 1);
    }
    if (i == s.size()) {
        string h{s.begin(), s.begin() + s.size() / 2};
        stringstream ss{h};
        int fh;
        ss >> fh;
        ret = fh;
        if (h.compare(string{s.begin() + s.size() / 2, s.end()}) > 0)
            ret--;
    }
    cout << ret << nl;
    return 0;
}

Submission Info

Submission Time
Task C - Doubled
User alabh
Language C++ (GCC 9.2.1)
Score 300
Code Size 848 Byte
Status AC
Exec Time 5 ms
Memory 3624 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   26 |     for (i = 2; i < s.size(); i += 2) {
      |                 ~~^~~~~~~~~~
./Main.cpp:29:11: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   29 |     if (i == s.size()) {
      |         ~~^~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 34
Set Name Test Cases
Sample 01_sample.txt, 02_sample.txt, 03_sample.txt
All 01_sample.txt, 02_sample.txt, 03_sample.txt, 04_hand.txt, 05_hand.txt, 06_hand.txt, 07_hand.txt, 08_hand.txt, 09_hand.txt, 10_random.txt, 11_random.txt, 12_random.txt, 13_random.txt, 14_random.txt, 15_random.txt, 16_random.txt, 17_random.txt, 18_random.txt, 19_random.txt, 20_random.txt, 21_random.txt, 22_random.txt, 23_random.txt, 24_random.txt, 25_random.txt, 26_random.txt, 27_random.txt, 28_random.txt, 29_random.txt, 30_double.txt, 31_double.txt, 32_double.txt, 33_double.txt, 34_double.txt
Case Name Status Exec Time Memory
01_sample.txt AC 5 ms 3524 KiB
02_sample.txt AC 3 ms 3616 KiB
03_sample.txt AC 2 ms 3612 KiB
04_hand.txt AC 2 ms 3496 KiB
05_hand.txt AC 2 ms 3528 KiB
06_hand.txt AC 2 ms 3492 KiB
07_hand.txt AC 3 ms 3584 KiB
08_hand.txt AC 3 ms 3564 KiB
09_hand.txt AC 3 ms 3508 KiB
10_random.txt AC 3 ms 3624 KiB
11_random.txt AC 3 ms 3564 KiB
12_random.txt AC 2 ms 3504 KiB
13_random.txt AC 2 ms 3596 KiB
14_random.txt AC 2 ms 3604 KiB
15_random.txt AC 3 ms 3620 KiB
16_random.txt AC 2 ms 3560 KiB
17_random.txt AC 3 ms 3452 KiB
18_random.txt AC 2 ms 3496 KiB
19_random.txt AC 5 ms 3592 KiB
20_random.txt AC 3 ms 3448 KiB
21_random.txt AC 2 ms 3596 KiB
22_random.txt AC 1 ms 3528 KiB
23_random.txt AC 4 ms 3560 KiB
24_random.txt AC 3 ms 3576 KiB
25_random.txt AC 2 ms 3572 KiB
26_random.txt AC 2 ms 3564 KiB
27_random.txt AC 3 ms 3532 KiB
28_random.txt AC 2 ms 3600 KiB
29_random.txt AC 2 ms 3544 KiB
30_double.txt AC 2 ms 3500 KiB
31_double.txt AC 2 ms 3596 KiB
32_double.txt AC 2 ms 3496 KiB
33_double.txt AC 2 ms 3596 KiB
34_double.txt AC 3 ms 3592 KiB