2016

来源:互联网 发布:js new york 编辑:程序博客网 时间:2024/04/28 12:27

CSU - 1803
2016
Time Limit: 5000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu
Submit

Status

Description

给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:
1. 1≤a≤n,1≤b≤m;
2. a×b 是 2016 的倍数。
Input

输入包含不超过 30 组数据。
每组数据包含两个整数 n,m (1≤n,m≤10 9).
Output
对于每组数据,输出一个整数表示满足条件的数量。
Sample Input
32 63
2016 2016
1000000000 1000000000
Sample Output
1
30576
7523146895502644

#include<iostream>#include<algorithm>main(){   const long long p = 2016;    long long m, n, sum;    using namespace std;    while(cin>>m>>n && (m||n)) {        sum = 0;        for(int i = 1; i <= min(m, p); i++) {            for(int j = 1; j <= min(n, p); j++) {                if((i*j)%2016==0) {                    sum += ((m-i)/p+1)*((n-j)/p+1);                }            }        }        cout<<sum<<endl;    }}

写完后感觉自己好傻逼

0 0
原创粉丝点击