【BZOJ4917】Hash Killer IV(简单数论)

it2022-05-05  115

对于左移加:其实就是解方程

由于i已确定 可以预处理出逆元

对于右移异或 可以直接模拟 因为前面一坨不会变

#include<bits/stdc++.h> #define uint unsigned int using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); int T; cin>>T; while(T--) { uint x; cin>>x; x*=4294901761u; for(int i=31-11;i>=0;i--) { x^=((x>>(i+11))&1)<<i; } x*=954437177u; for(int i=31-6;i>=0;i--) { x^=((x>>(i+6))&1)<<i; } x*=3222273025u; cout<<x<<'\n'; } }

转载于:https://www.cnblogs.com/Patrickpwq/articles/9817108.html


最新回复(0)