题解:P16337 「ALFR Round 10」Bit Problem
fish_love_cat · · 题解
这场真不是红红橙橙黄?这场真不是红红橙橙黄?这场真不是红红橙橙黄?
特判
于是
假设
所以
于是每次操作
当
直接模拟时间复杂度是
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,m,k;
cin>>n>>m>>k;
if(m==0){
cout<<n<<'\n';
continue;
}
while(k--&&n)n=n&max(n-m,0);
cout<<n<<'\n';
}
return 0;
}
//「是的。因此,〈沉滞的第十一兽〉的名字当然也有其意义。
// Croyance,『坚定不移的信赖』
// ……不过,这个词或许本来应该解释为『信仰』会比较好。」