Test instructions: The definition of good number is only 4, and 7 is composed, give you a good a, and ask you how many good it is.
Problem-Solving ideas: The number of preprocessing bits is K, and then enumerate the digits of n, if this bit is 7 then the answer is to add this bit to 4 of the case number.
Problem Solving Code:
1 //File name:b.cpp2 //Author:darkdream3 //Created time:2015 April 15 Wednesday 00:46 48 seconds4 5#include <vector>6#include <list>7#include <map>8#include <Set>9#include <deque>Ten#include <stack> One#include <bitset> A#include <algorithm> -#include <functional> -#include <numeric> the#include <utility> -#include <sstream> -#include <iostream> -#include <iomanip> +#include <cstdio> -#include <cmath> +#include <cstdlib> A#include <cstring> at#include <ctime> - #defineLL Long Long - - using namespacestd; - Charstr[ -]; - intLen; inLL sum[ the]; - intMain () { toscanf"%s", str); + intLen =strlen (str); -LL ans=0 ; theLL tmp =1; * for(inti =1; I <=9; i + +) $ {Panax NotoginsengTMP *=2; -Sum[i] = sum[i-1] +tmp; the } +Ans = sum[len-1]; A for(inti =0; i < Len;i + +) the { + if(str[i]=='7') - { $Ans + =1<< (len-i-1); $ } - } -printf"%lld\n", ans+1); the return 0; -}
View Code
Codeforces 535B Tavas and Saddas digital DP