码迷,mamicode.com
首页 > 其他好文 > 详细

2016 省赛第一题

时间:2016-09-06 22:53:08      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

 

 

 

Description

 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:
1. 1≤a≤n,1≤b≤m;
2. a×b 是 2016 的倍数。
 Input
输入包含不超过 30 组数据。

每组数据包含两个整数 n,m (1≤n,m≤109).

Output

对于每组数据,输出一个整数表示满足条件的数量。
Sample Input
32 63
2016 2016
1000000000 1000000000

Sample Output

1
30576
7523146895502644

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

2016 省赛第一题

标签:

原文地址:http://www.cnblogs.com/cyy2397683949/p/5847286.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!