Submission #54356624


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:16777216")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>  
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>
#include <bitset>
#include <random>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(A,value) memset(A,value,sizeof(A))

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
const double PI=acos(-1.0);

typedef long long Int;
typedef long long LL;
typedef unsigned long long UINT;
typedef vector <int> VI;
typedef pair <int, int> PII;
typedef pair <double, double> PDD;

const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 1024;
const int MAXK = 51;
const int MAX2 = 24000000;
const int LEN = 21;
const int BASE = 1000000000;
const int MOD = 998244353;

int a[MAX];
int R[MAX][MAX];

Int Pow(Int a, Int b)
{
  Int res = 1;
  a %= MOD;
  while (b > 0)
    if (b % 2 == 0)
    {
      b /= 2;
      a = a * a % MOD;
    }
    else
    {
      -- b;
      res = res * a % MOD;
    }

  return res;
}

int main()
{
  string s;
  cin >> s;

  stringstream ss;
  ss << s;
  Int n;
  ss >> n;

  Int r = 1;
  FOR (i,0,SZ(s)) r = r * 10 % MOD;

  Int w = (1 - Pow(r, n) + MOD) % MOD * Pow((1 - r % MOD + MOD) % MOD, MOD-2) % MOD;
  Int res = 0;

  FOR (i,0,SZ(s))
  {
    Int d = s[i]-'0';
    FOR (j,0,SZ(s)-i-1) d = d * 10 % MOD;

    res = (res + d * w) % MOD;
  }

  cout << res << endl;
  
  return 0;
}

Submission Info

Submission Time
Task D - 88888888
User witua
Language C++ 20 (gcc 12.2)
Score 350
Code Size 1989 Byte
Status AC
Exec Time 1 ms
Memory 3624 KiB

Compile Error

Main.cpp:2: warning: ignoring ‘#pragma comment ’ [-Wunknown-pragmas]
    2 | #pragma comment(linker, "/stack:16777216")
      | 

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 3
AC × 28
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3544 KiB
example_01.txt AC 1 ms 3480 KiB
example_02.txt AC 1 ms 3532 KiB
hand_00.txt AC 1 ms 3416 KiB
hand_01.txt AC 1 ms 3620 KiB
hand_02.txt AC 1 ms 3532 KiB
hand_03.txt AC 1 ms 3604 KiB
hand_04.txt AC 1 ms 3476 KiB
hand_05.txt AC 1 ms 3532 KiB
hand_06.txt AC 1 ms 3440 KiB
hand_07.txt AC 1 ms 3484 KiB
hand_08.txt AC 1 ms 3536 KiB
hand_09.txt AC 1 ms 3552 KiB
random_00.txt AC 1 ms 3392 KiB
random_01.txt AC 1 ms 3480 KiB
random_02.txt AC 1 ms 3440 KiB
random_03.txt AC 1 ms 3488 KiB
random_04.txt AC 1 ms 3476 KiB
random_05.txt AC 1 ms 3448 KiB
random_06.txt AC 1 ms 3416 KiB
random_07.txt AC 1 ms 3480 KiB
random_08.txt AC 1 ms 3412 KiB
random_09.txt AC 1 ms 3624 KiB
random_10.txt AC 1 ms 3476 KiB
random_11.txt AC 1 ms 3536 KiB
random_12.txt AC 1 ms 3476 KiB
random_13.txt AC 1 ms 3472 KiB
random_14.txt AC 1 ms 3604 KiB