#include <iostream> using namespace std; int bitManipulation1(int n, int m, int i) { return ((m>>i)&1) == 1? (n|(1<<i)) : (n&(~(1<<i))); //注意格式 } int main() { int n, m, i, t; cin >> t; while (t--) { cin >> n >> m >> i; cout << bitManipulation1(n, m, i) << endl; } return 0; }
原文地址:https://www.cnblogs.com/Latticeeee/p/8508617.html
时间: 2024-10-14 10:08:13