您现在的位置是:主页 > news > ps怎么做网站的广告条/福州网站开发公司

ps怎么做网站的广告条/福州网站开发公司

admin2025/4/21 12:41:23news

简介ps怎么做网站的广告条,福州网站开发公司,县区网站建设运行汇报,有专业做网站的学校吗Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:1. 1≤a≤n,1≤b≤m;2. ab 是 2016 的倍数。Input 输入包含不超过 30 组数据。每组数据包含两个整数 n,m (1≤n,m≤109).Output 对于每组数据,输出一个整数表示满足条…

ps怎么做网站的广告条,福州网站开发公司,县区网站建设运行汇报,有专业做网站的学校吗Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:1. 1≤a≤n,1≤b≤m;2. ab 是 2016 的倍数。Input 输入包含不超过 30 组数据。每组数据包含两个整数 n,m (1≤n,m≤109).Output 对于每组数据,输出一个整数表示满足条…

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

Hint

Source

湖南省第十二届大学生计算机程序设计竞赛
想法:分块进行求
代码一(我的):
#include<stdio.h>
#include<string.h>
int main()
{int n,m;while(scanf("%d%d",&n,&m)!=EOF){int i,j;long long cnt=0;for(i=1;i<=2016;i++){for(j=1;j<=2016;j++){if((i%2016*j%2016)%2016==0){cnt++;}}}long long cnt1=0;for(i=1;i<=2016;i++){for(j=1;j<=n%2016;j++){if((i%2016*j%2016)%2016==0){cnt1++;}}}long long cnt2=0;for(i=1;i<=2016;i++){for(j=1;j<=m%2016;j++){if((i%2016*j%2016)%2016==0){cnt2++;}}}long long cnt3=0;for(i=1;i<=n%2016;i++){for(j=1;j<=m%2016;j++){if((i%2016*j%2016)%2016==0){cnt3++;}}}// printf("%lld %lld %lld %lld\n",cnt*(n/2016)*(m/2016),cnt1*(m/2016),cnt2*(n/2016),cnt3);long long ans=cnt*(n/2016)*(m/2016)+cnt1*(m/2016)+cnt2*(n/2016)+cnt3;printf("%lld\n",ans);}return 0;
}
代码二:(别人的)
同余定理
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long LL;
LL a[2016],b[2016];
int main()
{LL n,m,ans;while(scanf("%lld%lld",&n,&m)!=EOF){ans=0;for(int i=0;i<2016;i++){a[i]=n/2016;b[i]=m/2016;}for(int i=1;i<=n%2016;i++){a[i]++;}for(int i=1;i<=m%2016;i++){b[i]++;}for(int i=0;i<2016;i++){for(int j=0;j<2016;j++){if((i*j)%2016==0){ans+=a[i]*b[j];}}}printf("%lld\n",ans);}return 0;
}
别人的好想法:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){long long cur=0;long long n,m;while(scanf("%lld%lld",&n,&m)!=EOF){cur=0;for(int i=1;i<=min((long long)2016,n);i++){for(int j=1;j<=min((long long)2016,m);j++){if((i*j)%2016==0){cur+=((n-i)/2016+1)*((m-j)/2016+1);}}}printf("%lld\n",cur);}return 0;
}