大意: 一天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. shell 编程中的 知识点 - 突然一下子就明白很多东西了

    按自己的意愿生活, 而且是::: 要敢于按自己的意志去活! 那是一种胆量和勇气!! shell中的结构, 只有选择(实际上if条件也是一种选择结构)和循环, 都是用关键字来替代 大括号的. 如: if ...

  2. bzoj1497 [NOI2006]最大获利 最大权闭合子图

    链接 https://www.lydsy.com/JudgeOnline/problem.php?id=1497 思路 最大权闭合子图的裸题 一开始知道是这个最大权闭合子图(虽然我不知道名字),但是我 ...

  3. SpringBoot 整合携程Apollo配置管理中心

    携程官网对apollo的使用讲解了很多种方式的使用,但是感觉一些细节还是没讲全,特别是eureka配置中心地址的配置 这里对springboot整合apollo说一下 >SpringBoot启动 ...

  4. CentOS7.2 问题收集 查看文件大小 查看端口

    1.在vmware中使用nat模式安装centos7.2,没有ifconfig命令? yum upgrade yum install net-tools 2.查看当前目录所有文件大小 [root@lo ...

  5. 题解——洛谷P2781 传教(线段树)

    可以说是数据结构学傻了的典型案例了 昨天跳到这题上 然后思考了一下 噫!好!线段树裸题 然后打完板子,发现\(  n \le 10^9 \) 显然线段树直接做不太行 然后这题又只有普及的难度 然后我就 ...

  6. 论文笔记之:Semi-supervised Classification with Graph Convolutional Networks

    Semi-supervised Classification with Graph Convolutional Networks 2018-01-16  22:33:36 1. 文章主要思想: 2. ...

  7. Xilinx_ISE 14.7 Win10 闪退

    打开D:\Xilinx\14.7\ISE_DS\ISE\lib\nt64 将libPortabilityNOSH.dll 重命名为libPortability.dll,替换原libPortabilit ...

  8. BZOJ 1143: [CTSC2008]祭祀river(二分图最大点独立集)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1143 题意: 思路: 二分图最大点独立集,首先用floyd判断一下可达情况. #include< ...

  9. Java基础 --Unix与Mac系统 文件路径分隔符(一)

    斜杠‘/’与反斜杠‘\’在不同系统的使用 1)Window平台使用反斜杠'\'作为文件层级分隔符:Windows使用反斜杠作为DOS命令提示符的参数标志,随着发展DOS命令符逐渐被淘汰,大部分情况下斜 ...

  10. python Exception中的raise、assert

    使用raise抛出异常 当程序出现错误,python会自动引发异常,也可以通过raise显式地引发异常.一旦执行了raise语句,raise后面的语句将不能执行. 演示raise用法. try: s ...