#include <algorithm> #include <array> #include <iostream> #define maxn static_cast<int>(1e9 + 10) #define mod static_cast<int>(109) #define mod1 998244353 #define all(_) _.begin(), _.end() #define endl '\n' #define range(var_name, stare, end, step) for (ll var_name = stare; var_name < end; var_name += step) #define pre(var_name, stare, end) for (ll var_name = stare; var_name < end; var_name++) #define erp(var_name, stare, end) for (ll var_name = stare; var_name > end; var_name--) #define _if(x, pred) |views::filter([&](auto &&x){return pred;}) #define _map(x, pred) |views::transform([&](auto && x){return pred;}) #define debug(x) cerr << "\nDebuging.." << (#x) << ':' << (x) << endl #define PS system("pause") #define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define rd read using ll = long long int; using namespace std; /*make_vector*/template <typename RET> auto make_vector(RET x) { return x; } template <typename T1, typename T2, typename... Args> auto make_vector(T1 m, T2 n, Args... arg) { using InnerType = decltype(make_vector(n, arg...)); return vector<InnerType>(m, make_vector(n, arg...)); } /*read*/template <typename T> inline void read(T& hfv_read_n) { hfv_read_n = 0; T hfv_read_x = 1; char hfv_read_c = getchar(); while (hfv_read_c < '0' || hfv_read_c > '9') { if (hfv_read_c == '-')hfv_read_x = -1; hfv_read_c = getchar(); } while (hfv_read_c >= '0' && hfv_read_c <= '9') { hfv_read_n = (hfv_read_n << 3) + (hfv_read_n << 1) + (hfv_read_c & 15); hfv_read_c = getchar(); } hfv_read_n *= hfv_read_x; } /*print*/template <typename T> void print(T hfv_print_n, char hfv_print_c = 0) { if (hfv_print_n < 0) putchar('-'), hfv_print_n = -hfv_print_n; if (hfv_print_n < 10) putchar(hfv_print_n + 48); else print(hfv_print_n / 10), putchar(hfv_print_n % 10 + 48); if (hfv_print_c) putchar(hfv_print_c); } array<array<int, 2>, 8> dir{ 1,0,0,1,-1,0,0,-1,1,1,-1,-1,1,-1,-1,1 }; //----------------------------- bool ifseven(int n) {//----------判断是否有7 while (n) { if ((n % 10) == 7) return 1; n /= 10; } return 0; } void slove() { ll cnt = 0; int n; rd(n); for (int i = 7; i <= n; i += 7)//---------添加7的整数倍 cnt++; for (int i = 1; i <= n; i++) { if (i % 7 == 0) continue;//----------去掉7的整数倍,放置重复 if (ifseven(i)) { cnt++; debug(i); }; } print(cnt); } /*-----------C-O-D-E----------*/ int main() { //IOS; int T = 1; //read(T); //---------------- //---------------- while (T--) { slove(); } return 0; } /* ┏┓ ┏┓+ + ┏┛┻━━━┛┻┓ + + ┃ ┃ ┃ ━ ┃ ++ + + + ████━████ ┃+ ┃ ┃ + ┃ ┻ ┃ ┃ ┃ + + ┗━┓ ┏━┛ ┃ ┃ ┃ ┃ + + + + ┃ ┃ Codes are far away from bugs with the animal protecting ┃ ┃ + 神兽保佑,代码大概率无bug(不过神兽偶尔也会休息哦~) ┃ ┃ Blessed by the mythical beast, may bugs stay far away ┃ ┃ + ┃ ┗━━━┓ + + ┃ ┣┓ ┃ ┏┛ ┗┓┓┏━┳┓┏┛ + + + + ┃┫┫ ┃┫┫ ┗┻┛ ┗┻┛+ + +++ */