题意
思路
很容易发现以7为一个循环节 那么先计算间距中有多少个循环节 再算下一开始的情况 因为右边是开区间 所以用需要摸7后需要大于1
code
#include <bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned long long #define mes(x, a) memset(x, a, sizeof(x)); #define sca(a) scanf("%d", &a) #define lowbit(x) x&(-x) #define mk make_pair #define pb(x) push_back(x) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define lson v << 1 #define rson v << 1 | 1 #define pii pair<int, int> void read(int &x) { x=0; int flag_read=1; char c=getchar(); while(c<'0'||c>'9') { if(c=='-') flag_read=-1; c=getchar(); } while(c>='0'&&c<='9') { x=(x<<3)+(x<<1)+c-'0'; c=getchar(); } x *= flag_read; } void out(int x){ if(x > 9){ out(x / 10); } putchar(x % 10 + '0'); } int main(){ ios::sync_with_stdio(0); LL n , m; cin >> n >> m; n = 1LL << n; m = 1LL << m; LL res = m - n; res /= 7; if(n%7 == 1 && m%7 > 1){ res ++ ; } cout << res << '\n'; return 0; }