标签:queue div pac lse == window col controls iostream
题解:
#include <iostream> #include<algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <queue> #define INF 0x3f3f3f3f #define DOF 0x7f7f7f7f #define mem(a,b) memset(a,b,sizeof(a)) typedef long long LL; using namespace std; LL f (LL a,LL b,LL c,LL n)//首项 公差 c 项数 { if (n==0) return 0; LL ans=(b/c)*n*(n-1)/2+(a/c)*n; ans=ans+f((b*n+a)%c,c,b%c,((b%c)*n+(a%c))/c); return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); LL x,y,z,k; while(cin>>x>>y>>z)//x-首项 y-最后一项 x+kz<=y | z-公差 { LL ans=0; k=(y-x)/z; for (LL u=0;u<32;u++) ans=ans|((f(x,z,(1LL<<u),k+1)&1LL)<<u); cout<<ans<<endl; } return 0; }
标签:queue div pac lse == window col controls iostream
原文地址:https://www.cnblogs.com/waryan/p/12244311.html