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 ...
随机推荐
- RootKit学习之 IDT Hook
0x00 前言 IDT(Interrupt Descriptor Table)中断描述符表,中断就是停下现在的活动,去完成新的任务.一个中断可以起源于软件或硬件.比如,出现页错误,调用IDT中的0x ...
- [Effective JavaScript 笔记]第3章:使用函数--个人总结
前言 这一章把平时会用到,但不会深究的知识点,分开细化地讲解了.里面很多内容在高3等基础内容里,也有很多讲到.但由于本身书籍的篇幅较大,很容易忽视对应的小知识点.这章里的许多小提示都很有帮助,特别是在 ...
- 异常:The absolute uri: http://www.springframework.org/security/tags cannot be resolved in either web.xml or the jar files deployed with this application
The absolute uri: http://www.springframework.org/security/tags cannot be resolved in either web.xml ...
- DrawText
该函数在指定的矩形里写入格式化的正文,根据指定的方法对正文格式化(扩展的制表符,字符对齐.折行等). int DrawText(HDC hDC, // 设备描述表句柄 LPCTSTR lpStri ...
- Linux Apache和Nginx的比较
1.nginx相对于apache的优点: 轻量级,同样起web 服务,比apache占用更少的内存及资源 抗并发,nginx 处理请求是异步非阻塞的,而apache 则是阻塞型的,在高并发下nginx ...
- Android 云服务器的搭建和友盟APP自动更新功能的实现
setContentView(R.layout.activity_splash); //Bmob SDK初始化--只需要这一段代码即可完成初始化 //请到Bmob官网(http://www.bmob. ...
- 数学复习 ---- Mathematics Notes: A Programmer's Perspective ---- by Orzer ---- 我是沙茶
今年是好没长进的一年呢..只学了些基本的方法.. 本文记号0] x:p x类型为p1] f(x) 表示一个函数2] (n_1,n_2,...) 表示多元组,特别的,(n)表示一个一元组3] x 表示一 ...
- CI邮箱中SMTP的一些端口
介绍其他几个常用邮箱设置,并以网易126邮箱为例,发图. 一.新浪邮箱(1)新浪邮箱自08年6月分服务器被攻击后开始对pop取件频率进行了严格**,同时新注册的用户需要手动才能开通pop ...
- Search Range in Binary Search Tree
Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Find all t ...
- Combination Sum | & || & ||| & IV
Combination Sum | Given a set of candidate numbers (C) and a target number (T), find all unique comb ...