#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define endl '\n'
#define ll long long
void solve() {
ll ban=1;
for(int i=2;i<=9;i++){
ll w=lcm(i,i+1);
ban=lcm(w,ban);
}
ll x;
cin>>x;
ll ans=x/ban;
cout<<ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
ll a, b, cnt = 0;
cin >> a >> b;
while (a != b) {
if (a < b)swap(a, b);
cnt += (a - 1) / b;
a -= (a - 1) / b * b;
}
cout << cnt;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
vector<ll>a(3);
cin >> a[0] >> a[1] >> a[2];
sort(a.begin(), a.end());
ll w = gcd(a[0], a[2]);
cout << a[0] / w << "/" << a[2] / w;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
int q, n;
scanf("%d", &q);
int odd[100005], even[100005];
odd[0] = 1;
for (int i = 1; i < 100001; i = i + 2) {
odd[i] = i + 2;
odd[i + 1] = i + 1;
}
for (int i = 0; i < 100001; i = i + 2) {
even[i] = i + 2;
even[i + 1] = i + 1;
}
while (q--) {
scanf("%d", &n);
if (n % 2) {
for (int i = 0; i < n; i++) printf("%d ", odd[i]);
} else for (int i = 0; i < n; i++) printf("%d ", even[i]);
printf("\n");
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define endl '\n'
#define ll long long
#define lowbit(x) ((x) & (-x))
#define lc u << 1
#define rc u << 1 | 1
#define ULL unsigned long long
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int mod1 = 1331;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
typedef pair<ll, ll> PII;
int dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
int b[1005][1005], a[1005];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> b[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i] |= b[i][j];
}
}
for (int i = 0; i < n; i++) {
cout << a[i] << " ";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--)
solve();
return 0;
}
#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;
const int N = 1e5 + 5;
int T, n, k, a[N], b[N], sum;
signed main()
{
scanf("%u", &T);
while(T--)
{
scanf("%u %u", &n, &k);
sum = 0;
for(int i = 1;i <= n;i++)
{
scanf("%u", &a[i]);
sum ^= a[i];
}
k %= 2;
k += n % 2;
for(int i = 1;i <= k;i++)
{
for(int i = 1;i <= n;i++)
b[i] = sum ^ a[i];
sum = 0;
for(int i = 1;i <= n;i++)
{
a[i] = b[i];
sum ^= a[i];
}
}
for(int i = 1;i <= n;i++)
printf("%u ", a[i]);
printf("\n");
}
return 0;
}
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define endl '\n'
#define ll long long
#define lowbit(x) ((x) & (-x))
#define lc u << 1
#define rc u << 1 | 1
#define ULL unsigned long long
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int mod1 = 1331;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
typedef pair<ll, ll> PII;
int dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
void solve() {
int n, m;
cin >> n >> m;
if (n == 1 && m == 2 || n == 2 && m == 1) {
cout << "Yes" << "\n";
} else {
cout << "No" << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define endl '\n'
#define ll long long
#define lowbit(x) ((x) & (-x))
#define lc u << 1
#define rc u << 1 | 1
#define ULL unsigned long long
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int mod1 = 1331;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
typedef pair<ll, ll> PII;
int dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
void solve() {
int n;
cin >> n;
int k = 1, cnt = 0;
while (k < n)k *= 2, cnt++;
if (k == n) {
cout << k << ' ' << 0 << endl;
return ;
}
cout << k << ' ';
for (int i = 0; i <= 30; i++) {
if ((n >> i) & 1) {
cout << cnt - i << endl;
return ;
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define endl '\n'
#define ll long long
#define lowbit(x) ((x) & (-x))
#define lc u << 1
#define rc u << 1 | 1
#define ULL unsigned long long
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int mod1 = 1331;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
typedef pair<ll, ll> PII;
int dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
void solve() {
ll n,m,flag=1;
cin>>n>>m;
if(n==m){
cout<<0<<"\n";
flag=0;
}
if(flag){
if((n|m)==n||(n|m)==m){
cout<<1<<"\n";
}else{
cout<<2<<"\n";
}}
flag=1;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define endl '\n'
#define ll long long
#define lowbit(x) ((x) & (-x))
#define lc u << 1
#define rc u << 1 | 1
#define ULL unsigned long long
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int mod1 = 1331;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
typedef pair<ll, ll> PII;
int dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
void solve() {
ULL x;
cin>>x;
cout<<((x&0x0000ffff)<<16|(x&0xffff0000)>>16)<<"\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--)
solve();
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
int n;
cin >> n;
int k = -1;
while (n) {
k++;
n = n / 2;
}
int ans = pow(2, k) - 1;
cout << ans << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int _ = 1;
cin >> _;
while (_--)
solve();
}
标签:运算,GCD,int,ll,long,include,solve,LCM,define
From: https://blog.csdn.net/2401_86494108/article/details/144119044