提出 #27972868


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

char s[101];
// (i, leq, k): X <= s[..i] もしくは X < s[..i] に対する数え上げ
int dp[101][2][4];

int main() {
  int k;
  scanf("%s%d", s, &k);
  int n = strlen(s);

  dp[0][1][0] = 1;

  rep(i, n) rep(leq, 2) rep(k, 4) rep(r, 10) {
    int ub = s[i] - '0' + leq;
    if (k - (r != 0) >= 0)
      dp[i + 1][leq][k] += dp[i][r < ub][k - (r != 0)];
  }

  printf("%d\n", dp[n][1][k]);
}

提出情報

提出日時
問題 E - Almost Everywhere Zero
ユーザ shino16
言語 C++ (GCC 9.2.1)
得点 500
コード長 515 Byte
結果 AC
実行時間 7 ms
メモリ 3792 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   11 |   scanf("%s%d", s, &k);
      |   ~~~~~^~~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 4
AC × 22
セット名 テストケース
Sample sample_01, sample_02, sample_03, sample_04
All hand_01, hand_02, hand_03, hand_04, hand_05, max_01, max_02, max_03, max_04, max_05, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, sample_01, sample_02, sample_03, sample_04
ケース名 結果 実行時間 メモリ
hand_01 AC 7 ms 3736 KiB
hand_02 AC 5 ms 3704 KiB
hand_03 AC 3 ms 3696 KiB
hand_04 AC 3 ms 3688 KiB
hand_05 AC 5 ms 3668 KiB
max_01 AC 2 ms 3600 KiB
max_02 AC 2 ms 3668 KiB
max_03 AC 2 ms 3552 KiB
max_04 AC 2 ms 3736 KiB
max_05 AC 3 ms 3792 KiB
random_01 AC 2 ms 3696 KiB
random_02 AC 2 ms 3780 KiB
random_03 AC 2 ms 3780 KiB
random_04 AC 2 ms 3568 KiB
random_05 AC 2 ms 3568 KiB
random_06 AC 2 ms 3552 KiB
random_07 AC 2 ms 3564 KiB
random_08 AC 2 ms 3672 KiB
sample_01 AC 2 ms 3564 KiB
sample_02 AC 2 ms 3700 KiB
sample_03 AC 2 ms 3644 KiB
sample_04 AC 2 ms 3596 KiB