大意: 一天n小时, m分钟, 表以7进制显示, 求表显示数字不同的方案数

注意到小时和分钟部分总长不超过7, 可以直接暴力枚举.

关键要特判0, 0的位数要当做1来处理

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <string.h>
#include <bitset>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
//head const int N = 1e6+10;
int x, y, tx, ty, vis[N];
int chk(int x, int y) {
REP(i,0,6) vis[i]=0;
REP(i,1,tx) ++vis[x%7],x/=7;
REP(i,1,ty) ++vis[y%7],y/=7;
REP(i,0,6) if (vis[i]>1) return 0;
return 1;
} int main() {
scanf("%d%d", &x, &y), --x, --y;
if ((ll)x*y>6543210) return puts("0"),0;
for (int i=x; i; i/=7) ++tx;
for (int i=y; i; i/=7) ++ty;
tx = max(tx,1), ty = max(ty,1);
int ans = 0;
REP(i,0,x) REP(j,0,y) ans+=chk(i,j);
printf("%d\n", ans);
}

Robbers' watch CodeForces - 685A (暴力)的更多相关文章

  1. CodeForces 670D1 暴力或二分

    今天,开博客,,,激动,第一次啊 嗯,,先来发水题纪念一下 D1. Magic Powder - 1   This problem is given in two versions that diff ...

  2. Codeforces Round #439 (Div. 2) Problem E (Codeforces 869E) - 暴力 - 随机化 - 二维树状数组 - 差分

    Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around ...

  3. Codeforces Round #439 (Div. 2) Problem A (Codeforces 869A) - 暴力

    Rock... Paper! After Karen have found the deterministic winning (losing?) strategy for rock-paper-sc ...

  4. Codeforces Round #425 (Div. 2) Problem B Petya and Exam (Codeforces 832B) - 暴力

    It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy ...

  5. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem C (Codeforces 831C) - 暴力 - 二分法

    Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain ...

  6. codeforces 691F 暴力

    传送门:https://codeforces.com/contest/691/problem/F 题意:给你n个数和q次询问,每次询问问你有多少对ai,aj满足ai*aj>=q[i],注意 a* ...

  7. Vicious Keyboard CodeForces - 801A (暴力+模拟)

    题目链接 题意: 给定一个字符串,最多更改一个字符,问最多可以有多少个“VK”子串? 思路: 由于数据量很小,不妨尝试暴力写.首先算出不更改任何字符的情况下有多个VK字串,然后尝试每一次更改一个位置的 ...

  8. (CodeForces 548B 暴力) Mike and Fun

    http://codeforces.com/problemset/problem/548/B Mike and some bears are playing a game just for fun. ...

  9. Once in a casino CodeForces - 1120B (暴力)

    大意: 给定两个字符串$a,b$, 每个字符为$0-9$, 每次操作将$a$中相邻两位加$1$或减$1$, 操作后每个数仍要为$0-9$, 求最少操作使$a$变成$b$. 先不考虑范围, 判断是否成立 ...

随机推荐

  1. win32汇编(ASM)学习资源

    网站 AoGo汇编小站(MASMPlus作者) Win32Asm教程在线版 Win32Asm教程博客园文件备份版 Masm32补充教程系列 Win32 ASM Tutorial Resource Ki ...

  2. (zhuan) 126 篇殿堂级深度学习论文分类整理 从入门到应用

    126 篇殿堂级深度学习论文分类整理 从入门到应用 | 干货 雷锋网 作者: 三川 2017-03-02 18:40:00 查看源网址 阅读数:66 如果你有非常大的决心从事深度学习,又不想在这一行打 ...

  3. (zhuan) Where can I start with Deep Learning?

    Where can I start with Deep Learning? By Rotek Song, Deep Reinforcement Learning/Robotics/Computer V ...

  4. Appium典型问题处理

    1. http://ask.testfan.cn/article/902 Appium 服务端安装-windows2. http://ask.testfan.cn/article/1078 最新版本a ...

  5. R----ggplot2包介绍学习--转载

    https://www.cnblogs.com/nxld/p/6059603.html 分析数据要做的第一件事情,就是观察它.对于每个变量,哪些值是最常见的?值域是大是小?是否有异常观测? ggplo ...

  6. 【Python】【网络编程】

    #[[网络编程]] # 网络通信就是两个进程之间在通信 # [TCP/IP]'''TCP/IP简介 阅读: 125242虽然大家现在对互联网很熟悉,但是计算机网络的出现比互联网要早很多. 计算机为了联 ...

  7. 在用node安装某个全局模块的时候,没有权限修改node_modules

    一.问题 今天在安装公司内部的一个npm模块的时候,发现报错了⬇ 第一行错误: deprecated graceful-fs@1.2.3: please upgrade to graceful-fs ...

  8. codeforces 768D Jon and Orbs

    题目链接:http://codeforces.com/problemset/problem/768/D 令$f[i][j]$表示当前产生过了$i$个球,产生过了$j$个不同的球的概率. ${Ans_i ...

  9. Hadoop 学习路线

    大数据实时计算工程师/Hadoop工程师/数据分析师职业路线图 描述 本路线图是一个专门针对大数据实时处理.Hadoop工程师和数据分析师所设计的课程体系介绍,在实时计算方向主要包括了从数据收集框架. ...

  10. Ubuntu16.04 上安装MySQL5.7

    Ubuntu版本:16.04.4 1.先更新最新的源 sudo apt-get update 2.查看是否已经安装过mysql sudo netstat -tap | grep mysq 如果没有安装 ...