luogu p4132算不出的等式

 

 打表找规律eee

#include<cstdio>
using namespace std;
typedef long long ll;
ll p,q;
//int main()
//{
//    ios::sync_with_stdio(false);
//    int p,q;
//    while(1)
//    {cin>>p>>q;
//    ll sum1=0,sum2=0,m=p/2,n=q/2;
//    for(int i=1;i<=m;i++)
//    sum1+=i*q/p;
//    for(int j=1;j<=n;j++)
//    sum2+=j*p/q;
//    cout<<sum1<<" "<<sum2<<" "<<sum1+sum2;} 
//}//打表
inline void read(long long &x)
{
    x = 0;char ch = getchar(), c = ch;
    while(ch < '0' || ch > '9') c = ch, ch = getchar();
    while(ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
    if(c == '-') x = -x;
} 
int main()
{
    read(p),read(q);
    if(p==q) printf("%lld",(p-1)*(q+1)>>2);
    else printf("%lld",(p-1)*(q-1)>>2);
    return 0;
}

特判p==q eee

 

posted @ 2020-05-14 08:13  INFP  阅读(151)  评论(1编辑  收藏  举报