题目链接:

  http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1803

题目大意:

  给定n,m(n,m<=109)1<=i<=n,1<=j<=m,求i*j%2016=0的方案数。

题目思路:

  【模拟】【数学】

  按照%2016的余数分类。每增加一个2016就又多一种方案。统计是2016的几倍,根据余数分类。最后枚举i,j的余数即可求解。

 //
//by coolxxx
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define mem(a,b) memset(a,b,sizeof(a))
#define eps (1e-8)
#define J 10000
#define mod 1000000007
#define MAX 0x7f7f7f7f
#define PI 3.14159265358979323
#define N 2104
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
LL aans;
int a[N],b[N];
void work(int x,int c[])
{
int i;
c[]=x/;
for(i=;i<=(x%);i++)c[i]=c[]+;
for(i=(x%)+;i<;i++)c[i]=c[];
}
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k; // for(scanf("%d",&cass);cass;cass--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s+1))
while(~scanf("%d",&n))
{
scanf("%d",&m);
aans=;
work(n,a);
work(m,b);
for(i=;i<;i++)
for(j=;j<;j++)
if((i*j)%==)
aans+=1LL*a[i]*b[j];
printf("%lld\n",aans);
}
return ;
}
/*
// //
*/

【模拟】【数学】CSU 1803 2016 (2016湖南省第十二届大学生计算机程序设计竞赛)的更多相关文章

  1. 2016年湖南省第十二届大学生计算机程序设计竞赛---Parenthesis(线段树求区间最值)

    原题链接 http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1809 Description Bobo has a balanced parenthes ...

  2. 2016年湖南省第十二届大学生计算机程序设计竞赛Problem A 2016 找规律归类

    Problem A: 2016 Time Limit: 5 Sec  Memory Limit: 128 MB Description  给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) ...

  3. 湖南省第十二届大学生计算机程序设计竞赛 A 2016

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

  4. 湖南省第十二届大学生计算机程序设计竞赛 problem A 2016

    如果 a * b % 2016 == 0 如果a = 1 ,且 a * b % 2016 == 0 考虑一下a = 2017的时候 2017 * b = (2016 + 1) * b % 2016 = ...

  5. 【模拟】CSU 1807 最长上升子序列~ (2016湖南省第十二届大学生计算机程序设计竞赛)

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1807 题目大意: 给你一个长度为N(N<=105)的数列,数列中的0可以被其他数 ...

  6. 【最短路】【数学】CSU 1806 Toll (2016湖南省第十二届大学生计算机程序设计竞赛)

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1806 题目大意: N个点M条有向边,给一个时间T(2≤n≤10,1≤m≤n(n-1), ...

  7. 【数学】CSU 1810 Reverse (2016湖南省第十二届大学生计算机程序设计竞赛)

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1810 题目大意: 一个长度为N的十进制数,R(i,j)表示将第i位到第j位翻转过来后的 ...

  8. 【树状数组】CSU 1811 Tree Intersection (2016湖南省第十二届大学生计算机程序设计竞赛)

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1811 题目大意: 一棵树,N(2<=N<=105)个节点,每个节点有一种颜 ...

  9. 【拓扑】【宽搜】CSU 1084 有向无环图 (2016湖南省第十二届大学生计算机程序设计竞赛)

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1804 题目大意: 一个有向无环图(DAG),有N个点M条有向边(N,M<=105 ...

随机推荐

  1. oracle多表关联删除数据表记录方法

    oracle多表关联删除的两种方法 第一种使用exists方法 delete from tableA where exits ( select 1 from tableB Where tableA.i ...

  2. 比较好的自学IT的网站

    其实这是我在知乎的一个回答,由于收藏人数众多,我想也许对有些初学者有用,故同步到Blog.此文章和知乎答案将不定期同步更新(知乎答案传送门). 入门与进阶: 学堂在线-最大的中文慕课(MOOC)平台学 ...

  3. Eclipse设立不格式化注释

    From:http://www.educity.cn/wenda/467693.html Eclipse设置不格式化注释 注释中写点带格式的文字,format后全乱了,解决办法如下: Windows ...

  4. 详解SQL Server 2005 Express下的事件探查器

    安装Visual Studio 2008会有附带的SQL Server 2005 Express版 我们开发一般都用那个都不单独安装SQL Server的 大家都知道express版的sql是没有 事 ...

  5. iOS CGContextRef 画图小结

    CGContextRef context = UIGraphicsGetCurrentContext(); //设置上下文 //画一条线 CGContextSetStrokeColorWithColo ...

  6. C# Base64编码/解码

    一.编码规则      Base64编码的思想是是采用64个基本的ASCII码字符对数据进行重新编码.它将需要编码的数据拆分成字节数组.以3个字节为一组.按顺序排列24 位数据,再把这24位数据分成4 ...

  7. IIS部署.NET项目的有关事项_2015.07.02

    今天在做项目中的关于发送邮件的一些功能.在部署服务的时候遇到了一些奇葩的问题,基本上是和IIS有关的问题. 首先,项目是基于.NET Framework4.0 版本的,由于本人用的是一台新配置好的机器 ...

  8. hash表的建立和查找

    (1)冲突处理方法为:顺次循环后移到下一个位置,寻找空位插入.(2)BKDE 字符串哈希unsigned int hash_BKDE(char *str){/* 初始种子seed 可取31 131 1 ...

  9. 不带头结点的单链表递归删除元素为X的结点

    #include <iostream> using namespace std; struct Node { Node *next; int elem; }; void creatList ...

  10. GridBagLayout的帮助类

    自备详细注释 /* * To change this license header, choose License Headers in Project Properties. * To change ...