A 753

Solved.

     #include <bits/stdc++.h>
using namespace std; int mp[]; int main()
{
mp[] = mp[] = mp[] = ;
int x; cin >> x;
puts(mp[x] ? "YES" : "NO");
}

B 754

Solved.

     #include <bits/stdc++.h>
using namespace std; char s[]; int f(int x)
{
int res = ;
for (int i = ; i < ; ++i) res = res * + s[i + x] - '';
return res;
} int main()
{
while (scanf("%s", s + ) != EOF)
{
int res = 0x3f3f3f3f, len = strlen(s + );
for (int i = ; i <= len - ; ++i) res = min(res, abs(f(i) - ));
printf("%d\n", res);
}
return ;
}

C 755

Solved.

题意:

找出$[1, n]中有多少个只由'7', '5', '3' 组成,并且每个字符至少出现一次的数$

思路:

这样的数不会太多,DFS构造,然后二分

     #include <bits/stdc++.h>
using namespace std; vector <int> v; bool ok(int x)
{
int flag[] = {false};
while (x)
{
flag[x % ] = ;
x /= ;
}
if (flag[] == || flag[] == || flag[] == ) return false;
return true;
} void DFS(int cur, int num)
{
if (cur == )
{
if (ok(num)) v.push_back(num);
return;
}
DFS(cur + , num);
DFS(cur + , num * + );
DFS(cur + , num * + );
DFS(cur + , num * + );
} int main()
{
DFS(, );
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
int n;
while (scanf("%d", &n) != EOF) printf("%d\n", (int)(upper_bound(v.begin(), v.end(), n) - v.begin()));
return ;
}

D 756

Upsolved.

题意:

有$N!中所有因子中,有多少因子其拥有的因子个数恰好为75个$

思路:

我们考虑$75 = 75 \cdot 1 = 25 \cdot 3 = 15 \cdot 5 = 5 \cdot 5 \cdot 3$

那么我们处理出$N!中每个质因子一共有多少个,然后考虑质因子个数如何组成因子个数$

考虑一个数$x = a_1^{p_1} \cdot a_2^{p_2} \cdot a_3^{p_3}$

那么$a_1 可以提供的因子个数为 (p_1 + 1) 那么x 的因子个数即 (p_1 \cdot p_2 \cdot p_3)$

然后简单组合一下就可以了

         #include <bits/stdc++.h>
using namespace std; int n;
int cnt[];
int tot[]; int f(int l, int r)
{
int res = ;
for (int i = l; i <= r; ++i) res += tot[i];
return res;
} int main()
{
while (scanf("%d", &n) != EOF)
{
memset(cnt, , sizeof cnt);
memset(tot, , sizeof tot);
for (int i = ; i <= n; ++i)
{
int tmp = i;
for(int j = ; ; ++j)
{
while (tmp % j == )
{
++cnt[j];
tmp /= j;
}
if (tmp == ) break;
}
}
for (int i = ; i <= ; ++i) ++tot[cnt[i] + ];
int res = f(, );
res += f(, ) * f(, );
res += f(, ) * (f(, ) - );
res += f(, ) * f(, );
res += f(, ) * (f(, ) - );
res += (f(, ) * (f(, ) - ) / ) * f(, );
res += ((f(, ) * (f(, ) - ) / ) * (f(, ) - ));
printf("%d\n", res);
}
return ;
}

AtCoder Beginner Contest 114 Solution的更多相关文章

  1. AtCoder Beginner Contest 131 Solution

    前言 这次ABC还是有一点难度的吧. TaskA Security Solution 直接模拟就好了. Code /* mail: mleautomaton@foxmail.com author: M ...

  2. AtCoder Beginner Contest 115 Solution

    A Christmas Eve Eve Eve Solved. #include <bits/stdc++.h> using namespace std; int main() { int ...

  3. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  4. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  5. AtCoder Beginner Contest 154 题解

    人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We ...

  6. AtCoder Beginner Contest 238 A - F 题解

    AtCoder Beginner Contest 238 \(A - F\) 题解 A - Exponential or Quadratic 题意 判断 \(2^n > n^2\)是否成立? S ...

  7. AtCoder Beginner Contest 100 2018/06/16

    A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...

  8. AtCoder Beginner Contest 052

    没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...

  9. AtCoder Beginner Contest 136

    AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...

随机推荐

  1. hadoop程序MapReduce之SingletonTableJoin

    需求:单表关联问题.从文件中孩子和父母的关系挖掘出孙子和爷奶关系 样板:child-parent.txt xiaoming daxiong daxiong alice daxiong jack 输出: ...

  2. Nginx(一)-- 初体验

    1.概念 Nginx ("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 服务器. Nginx提供基本http服务,可以作 ...

  3. Spring学习笔记--注入Bean属性

    这里通过一个MoonlightPoet类来演示了注入Bean属性property的效果. package com.moonlit.myspring; import java.util.List; im ...

  4. java基础---->摘要算法的介绍

    数据摘要算法是密码学算法中非常重要的一个分支,它通过对所有数据提取指纹信息以实现数据签名.数据完整性校验等功能,由于其不可逆性,有时候会被用做敏感信息的加密.数据摘要算法也被称为哈希(Hash)算法. ...

  5. js判断手机型号

    由于oppo手机自带浏览器的高度底部多了144px导航栏 所以:专门针对oppo手机做适配: var dowphone = document.getElementById("dowphone ...

  6. SNMP信息泄露漏洞

    SNMP协议简介 名称:SNMP(Simple Network Management Protocol)简单网络管理协议 端口:161 协议:UDP 用途:SNMP代理者以变量呈现管理资料.管理系统透 ...

  7. 3.node的url属性

    node的url属性 1.parse: [Function: urlParse],2.format: [Function: urlFormat],3.resolve: [Function: urlRe ...

  8. js的字符串charAt()方法

    //字符中的字符从左向右进行索引,由0开始,字符串中的空格也算在内 var string = "charAt find word position"; document.write ...

  9. 高中生的IT之路-1.3那一幕

    上一篇讲到,当时我认为自己的命运就是小时候上学,长大后外出打工,所以高中毕业后就来到了天津,到爸爸的店铺打工. 我爸的店铺就在天津大学校园里,幸运的是,我人生的转折点也就在此. 刚到店里那段时间,每天 ...

  10. 【BZOJ4372】烁烁的游戏 动态树分治+线段树

    [BZOJ4372]烁烁的游戏 Description 背景:烁烁很喜欢爬树,这吓坏了树上的皮皮鼠.题意:给定一颗n个节点的树,边权均为1,初始树上没有皮皮鼠.烁烁他每次会跳到一个节点u,把周围与他距 ...