[Noip simulation title] lucky

#include <bits / STDC ++ H.>
the using namespace STD;
unsigned Long Long F [21 is] [10], ANS, len, B [1010];        F [i] [J] represents takes i bits of the first number is J
char A [32];
int main () {
Scanf ( "% S", A +. 1);      because the space in the range of 10 ^ 20, so that the use char read
len = strlen (A +. 1);
for (int I =. 1 ; <= len I; I ++) {
ANS = ANS * 10 + A [I] - '0';
B [I] = A [I] - '0';
}
F [0] [0] =. 1;    because f array is not the case 49, so initially. 1
for (int I =. 1; I <= len; I ++)
for (int J = 0; J <=. 9; J ++)
for (int K = 0; K < =. 9; K ++)
!! IF (J =. 4 || K =. 9)
F [I] [J] + = F [I-. 1] [K];    accumulated state transition equation
for (int i = 1; i <= len; I ++) {
for (int J = 0; J <B [I]; J ++)  from 0 to the current number minus one is not greater than or equal value, so that it is guaranteed that one no matter how much to take than the original small number
ans- = f [len-i +  1] [j]; must write down, because the bits are taken from a plurality of bits to a small number of bits
if (b [i-1] == 4 && b [ i] == 9) {    go weight: 49 because there have been no need to scan down
ANS ++;
BREAK;
}
}
COUT << ANS;
}

Guess you like

Origin www.cnblogs.com/nlyzl/p/11262311.html