zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Python Day14
    Python Day13
    Python Day12
    Python Day11
    Python Day10
    Python Day9
    Python Day8
    Python Day7
    Python Day6
    Python Day5
  • 原文地址:https://www.cnblogs.com/shikeyu/p/12886218.html
Copyright © 2011-2022 走看看