Codeforces Round #292 (Div. 2)
无算法,判断(s - (a + b)) % 2是否为零,若零,表示在s步内还能走向其他的地方并且回来
否则,都是No
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <set>
using namespace std; const int MAXN = 1e6 + 10;
const int INF = 0x3f3f3f3f; int main(void)
{
//freopen ("A.in", "r", stdin); long long a, b, s; while (~scanf ("%I64d%I64d%I64d", &a, &b, &s))
{
if (a < 0) a = -a;
if (b < 0) b = -b;
if (a + b <= s)
{
int x = s - (a + b);
if (x % 2 == 0) puts ("Yes");
else puts ("No");
}
else puts ("No");
} return 0;
}
B. Drazil and His Happy Friends
无算法,标记和更新happy的人就行了
少写一个&!,导致runtime error
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <set>
using namespace std; const int MAXN = 1e6 + 10;
const int INF = 0x3f3f3f3f;
int a[110], b[110]; int main(void)
{
//freopen ("B.in", "r", stdin); int n, m;
scanf ("%d%d", &n, &m); memset (a, 0, sizeof (a));
memset (b, 0, sizeof (b)); int x, y, tmp, cnt = 0;
scanf ("%d", &x);
for (int i=0; i<x; ++i)
{
scanf ("%d", &tmp);
a[tmp] = 1;
cnt++;
}
scanf ("%d", &y);
for (int i=0; i<y; ++i)
{
scanf ("%d", &tmp);
b[tmp] = 1;
cnt++;
} for (int i=0; i<=m*n*2; ++i)
{
if (a[i%n] || b[i%m])
{
if (!a[i%n]) cnt++;
if (!b[i%m]) cnt++;
a[i%n] = b[i%m] = 1;
}
}
(cnt == n + m) ? puts ("Yes") : puts ("No"); return 0;
}
无算法,数学问题貌似就是对单个数字分解质因数,替换,然后sort排序就行了
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <set>
using namespace std; const int MAXN = 1e6 + 10;
const int INF = 0x3f3f3f3f; string res[10] = {"", "", "2", "3", "322", "5", "53", "7", "7222", "7332"}; int main(void)
{
//freopen ("C.in", "r", stdin); int n;
while (cin >> n)
{
string s, ans;
cin >> s;
for (int i=0; i<s.size(); ++i)
{
ans += res[s[i] - '0'];
}
sort (ans.begin (), ans.end ());
reverse (ans.begin (), ans.end ()); cout << ans << endl;
} return 0;
}
Codeforces Round #292 (Div. 2)的更多相关文章
- Codeforces Round #292 (Div. 2) C. Drazil and Factorial
题目链接:http://codeforces.com/contest/515/problem/C 给出一个公式例如:F(135) = 1! * 3! * 5!; 现在给你一个有n位的数字a,让你求这样 ...
- Codeforces Round #292 (Div. 1) C. Drazil and Park 线段树
C. Drazil and Park 题目连接: http://codeforces.com/contest/516/problem/C Description Drazil is a monkey. ...
- Codeforces Round #292 (Div. 1) B. Drazil and Tiles 拓扑排序
B. Drazil and Tiles 题目连接: http://codeforces.com/contest/516/problem/B Description Drazil created a f ...
- Codeforces Round #292 (Div. 1) B. Drazil and Tiles (类似拓扑)
题目链接:http://codeforces.com/problemset/problem/516/B 一个n*m的方格,'*'不能填.给你很多个1*2的尖括号,问你是否能用唯一填法填满方格. 类似t ...
- Codeforces Round #292 (Div. 1)A. Drazil and Factorial 构造
A. Drazil and Factorial 题目连接: http://codeforces.com/contest/516/problem/A Description Drazil is play ...
- Codeforces Round #292 (Div. 1) - B. Drazil and Tiles
B. Drazil and Tiles Drazil created a following problem about putting 1 × 2 tiles into an n × m gri ...
- codeforces 516c// Drazil and Park// Codeforces Round #292(Div. 1)
题意:一个圆环上有树,猴子上下其中一棵树,再沿着换跑,再上下另一棵树.给出一个区间,问最大的运动距离是. 给出区间大小dst,和数高数组arr. 设区间[x,y],a[x]=2*arr[x]+dst[ ...
- Codeforces Round #292 (Div. 1) C - Drazil and Park
C - Drazil and Park 每个点有两个值Li 和 Bi,求Li + Rj (i < j) 的最大值,这个可以用线段树巧妙的维护.. #include<bits/stdc++. ...
- Codeforces Round #292 (Div. 2) D. Drazil and Tiles [拓扑排序 dfs]
传送门 D. Drazil and Tiles time limit per test 2 seconds memory limit per test 256 megabytes Drazil cre ...
随机推荐
- 怎么让dedecms生成html页面更快些
如何让织梦生成html页面更快些呢? 1.把文章模板里的“相关文章”.“热点文章”.“推荐文章”这类的标记删除了,用其它方式,如:shtml.js 引入 2.把织梦模板里用标记表示的模板路径.php附 ...
- Populating Next Right Pointers in Each Node
这题代码简单,不过不容易想到. void connect(TreeLinkNode *root) { if (root == nullptr ||root->left==nullptr)retu ...
- 破解TP-Link路由-嗅探PPPoE拨号密码
如果你平时都使用路由器直接上网,那么你还记得你的宽带(ADSL)帐户名和密码吗?忘记密码后又该如何找回呢?别急,本文带你一同找回遗忘的ADSL密码.1.安全性较差的路由器(例如腾达的某些路由器):这里 ...
- ICMP-type对应表
一次在某个防火墙配置策略里看到如下的代码: iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT iptables -A FORWARD -p icmp ...
- maven No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
maven install项目时出错,提示信息如下: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-pl ...
- 用php实现遍历目录
用php实现的遍历目录,只遍历第一层,如果制作在线文件管理器的话很管用,不同目录只加一个超链接就行了,然后给方法传递参数就行了,遍历目录的类如下: class Ergodic{ public func ...
- Fastreport使用经验(转)在Delphi程序中访问报表对象
Fastreport使用经验(转) 在Delphi程序中访问报表对象 最基本的方法就是frxReport1.FindObject. 然后把返回的对象强制转换成它的类型,当然,在报表中必须真的有这么个东 ...
- HDU1297 Children’s Queue (高精度+递推)
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- Base Filtering Engine 拒绝访问解法
基本筛选引擎(BFE)是一种管理防火墙和 Internet 协议安全(IPsec)策略以及实施用户模式筛选的服务.停止或禁用 BFE 服务将大大降低系统的安全.还将造成 IPsec 管理和防火墙应用程 ...
- vm 负责虚拟机出现“”适配器 的mac地址在保留地址范围内‘’
我自己在windows中文件中,直接将一个虚拟机进行复制了一份,后用vm打开, 选择我已经移到,结果会出现了一下的情况, 导致了我无法ping 通,故我看到一下提示: 原来是我两台虚拟机的MaC ,即 ...