whust2016 warm up A ||codeforces 682 A. Alyona and Numbers (计数问题,水)
题意:两个数组,分别为1..n和1..m。。。从两个数组中各取一个,问和能被5整除的方案数。。。
思路:傻逼题。。。统计%5。。。然后乘法原理。。
1/* ***********************************************
2Author :111qqz
3Created Time :2016年07月18日 星期一 12时32分22秒
4File Name :code/2016whust/A.cpp
5************************************************ */
6
7#include <cstdio>
8#include <cstring>
9#include <iostream>
10#include <algorithm>
11#include <vector>
12#include <queue>
13#include <set>
14#include <map>
15#include <string>
16#include <cmath>
17#include <cstdlib>
18#include <ctime>
19#define fst first
20#define sec second
21#define lson l,m,rt<<1
22#define rson m+1,r,rt<<1|1
23#define ms(a,x) memset(a,x,sizeof(a))
24typedef long long LL;
25#define pi pair < int ,int >
26#define MP make_pair
27
28using namespace std;
29const double eps = 1E-8;
30const int dx4[4]={1,0,0,-1};
31const int dy4[4]={0,-1,1,0};
32const int inf = 0x3f3f3f3f;
33const int N=1E6+7;
34int n,m;
35LL a[N],b[N];
36int main()
37{
38 #ifndef ONLINE_JUDGE
39 freopen("code/in.txt","r",stdin);
40 #endif
41
42 cin>>n>>m;
43 ms(a,0);
44 ms(b,0);
45 for ( int i = 1 ; i <= n ; i++)
46 {
47 int x = i % 5;
48 a[x]++;
49 }
50 for ( int i = 1 ; i <= m ; i++)
51 {
52 int x = i % 5;
53 b[x]++;
54 }
55 LL ans = 0;
56 ans = a[0]*b[0]+a[1]*b[4]+a[2]*b[3]+a[3]*b[2]+a[4]*b[1];
57 cout<<ans<<endl;
58
59 #ifndef ONLINE_JUDGE
60 fclose(stdin);
61 #endif
62 return 0;
63}