2015 Syrian Private Universities Collegiate Programming Contest 题解
2016-11-01 09:54
519 查看
题目在这里>_<
发现这场比赛在网上没有完整的题解,甚至连题目代码都没人贴出来(大概是因为题目太水了吧。。。)。所以宝宝就来写个题解,也就当作成长记录了233333
A. Window
题意很简单,给出n组x,y,求x*y的值
View Code
发现这场比赛在网上没有完整的题解,甚至连题目代码都没人贴出来(大概是因为题目太水了吧。。。)。所以宝宝就来写个题解,也就当作成长记录了233333
A. Window
题意很简单,给出n组x,y,求x*y的值
#include <cstdio> #include <algorithm> using namespace std; const int Mod=1000000007; struct ll { long long x; ll() {x=0;} ll(long long tttt) {x=tttt;} ll operator + (ll b) { ll c; c.x=(x+b.x)%Mod; return c; } ll operator * (ll b) { ll c; c.x=(x*b.x)%Mod; return c; } ll operator -(ll b) { ll c; c.x=(x-b.x)%Mod; return c; } }; ll get(ll n,ll m,ll k) { ll get_value(0); if(k.x<=m.x && k.x<=n.x) return (m-k+1)*n + (n-k+1)*m; if(k.x>m.x && k.x<=n.x) return (n-k+1)*m; if(k.x>n.x && k.x<=m.x) return (m-k+1)*n; return get_value; } ll max(ll a,ll b) { if(a.x>=b.x) return a; else return b; } ll min(ll a,ll b) { if(a.x<=b.x) return a; else return b; } int main() { //freopen("k.in","r",stdin); int t; ll two(2),four(4),one(1),eight(8); scanf("%d",&t); long long tmpn,tmpm,tmps,tmpk; for(int i=1;i<=t;i++) { scanf("%I64d%I64d%I64d%I64d",&tmpn,&tmpm,&tmps,&tmpk); ll n(tmpn),m(tmpm),s(tmps),k(tmpk); ll l=max(k,s); ll r=min(k,s); ll ans=(two*m*n-(m+n)*(k-one))*(two*m*n-(m+n)*(s-one)); ll a=min(m,k+s-one); ll b=min(n,k+s-one); ans=ans-k*s*( (n-s+one)*(m-k+one)+(n-k+one)*(m-s+one) ); ans=ans-(m-l+one)*n*(l-r+one)-(n-l+one)*m*(l-r+one); ans=ans-n*(a-l)*( two*(m+one)-(a+l+one) ); ans=ans-m*(b-l)*( two*(n+one)-(b+l+one) ); ans=ans*four; if(ans.x<0) ans.x+=Mod; printf("Case %d: %I64d\n",i,ans.x); } return 0; }
View Code
相关文章推荐
- 2015 ACM Syrian Collegiate Programming Contest
- The 2015 China Collegiate Programming Contest D.Pick The Sticks hdu 5543
- ACM Arabella Collegiate Programming Contest 2015 H. Capital City 边连通分量
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(2015浙江省赛)
- 2015 ACM Arabella Collegiate Programming Contest(F题)
- 2015 China Collegiate Programming Contest
- Gym 100952I&&2015 HIAST Collegiate Programming Contest I. Mancala【模拟】
- hdu5551Huatuo's Medicine(The 2015 China Collegiate Programming Contest )
- The 2015 China Collegiate Programming Contest E. Ba Gua Zhen hdu 5544
- 2015-2016 ACM-ICPC Nordic Collegiate Programming Contest ---E题Entertainment Box(有点变化的贪心)
- Gym 100952J&&2015 HIAST Collegiate Programming Contest J. Polygons Intersection【计算几何求解两个凸多边形的相交面积板子题】
- 2015 ACM Amman Collegiate Programming Contest D.Alternating Strings【Dp】
- CodeForces-2015 HIAST Collegiate Programming Contest-Gym-100952A-Who is the winner?
- AlBaath Collegiate Programming Contest (2015) 总结
- Gym 100952A&&2015 HIAST Collegiate Programming Contest A. Who is the winner?【字符串,暴力】
- 2015 ACM Amman Collegiate Programming Contest H.Bridges【边双联通+求树上最长链(树的直径)】
- The 2015 China Collegiate Programming Contest G. Ancient Go hdu 5546
- Gym 100952B&&2015 HIAST Collegiate Programming Contest B. New Job【模拟】
- The 2015 China Collegiate Programming Contest D Pick The Sticks
- 【Codeforces】2015-2016 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2015) A Adjoin the Netwo