zoukankan      html  css  js  c++  java
  • CSU 1803 2016

    湖南省第十二届大学生计算机程序设计竞赛$A$题

    枚举。

    处理一下$\% 2016$之后的数分别有几个,然后$2016*2016$枚举一下统计方案数就可以了。

    #pragma comment(linker, "/STACK:1024000000,1024000000")
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    #include<vector>
    #include<map>
    #include<set>
    #include<queue>
    #include<stack>
    #include<iostream>
    using namespace std;
    typedef long long LL;
    const double pi=acos(-1.0),eps=1e-6;
    void File()
    {
        freopen("D:\in.txt","r",stdin);
        freopen("D:\out.txt","w",stdout);
    }
    template <class T>
    inline void read(T &x)
    {
        char c = getchar(); x = 0;while(!isdigit(c)) c = getchar();
        while(isdigit(c)) { x = x * 10 + c - '0'; c = getchar();  }
    }
     
    LL n,m,a[3000],b[3000];
     
    int main()
    {
        while(~scanf("%lld%lld",&n,&m))
        {
            memset(a,0,sizeof a); memset(b,0,sizeof b);
            for(int i=0;i<2016;i++) a[i]=n/(LL)2016,b[i]=m/(LL)2016;
            for(int i=1;i<=n%2016;i++) a[i]++;
            for(int i=1;i<=m%2016;i++) b[i]++;
            LL ans=0;
            for(int i=0;i<2016;i++)
                for(int j=0;j<2016;j++)
                    if(i*j%2016==0) ans=ans+a[i]*b[j];
            cout<<ans<<endl;
        }
        return 0;
    }
  • 相关阅读:
    蓝牙模块连接后出现ANR,日志记录
    移动基站问题
    从地址栏获取字符串
    jquery升级换代
    手机屏幕的触点
    屏幕翻转后要干什么
    条件判断后吸住底部的总结
    mouseenter 和 mouseleave
    自动垂直居中的js
    数学方法代替浮动解决自动换行排列
  • 原文地址:https://www.cnblogs.com/zufezzt/p/5838118.html
Copyright © 2011-2022 走看看