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 ...
随机推荐
- Valid Pattern Lock(dfs + 暴力)
Valid Pattern Lock Time Limit: 2 Seconds Memory Limit: 65536 KB Pattern lock security is genera ...
- Python 常用函数大体分类
==================系统库函数================ 字符串函数 举例数学函数 import math val=math.sin(3.14/6) val=math.sin(m ...
- 淘宝(阿里百川)手机客户端开发日记第八篇 Handler的使用方法
首先,我们先看下API文档的说明: A Handler allows you to send and process Message and Runnable objects associated w ...
- Linux下的网络管理工具—OpenNMS
导读 OpenNMS的是一个运营商级别的,高度集成的,开放源码的平台,用于构建网络监控解决方案.OpenNMS有两个发行版:Meridian and Horizon.使用Meridian是可取的,对企 ...
- storyboard和xib的各种问题
1.prepareFoSegue注意问题使用该方法设置的值, 必须要 viewWillApear之后用 2.storayboard的使用autolayout, constant = -16, 刚好在f ...
- node.js模拟qq漂流瓶
(文章是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) node.js模拟简易漂流瓶,页面有扔瓶子和捡瓶子的功能,一个瓶子只能被捡到一次,阅读完就置状态位, ...
- Android计时器实例
布局文件 <Chronometer android:id="@+id/chronometer" android:layout_width="wrap_content ...
- Delphi与C语言类型转换对照
When converting C function prototypes to Pascal equivalent declarations, it's important to substitut ...
- qsort用法总结
一.对int类型数组排序 ]; int cmp ( const void *a , const void *b ) { return *(int *)a - *(int *)b; } qsort(nu ...
- 破解php-screw加密过的文件有效方法
今天终于搞定更改过密钥的php-screw解密问题,乐呵一下! 改进下 这样就可以解密任何加密过的PHP源码(包括更改过密钥的),解密的原理稍后具体列出,先说下如何加密 列出之前写使用php scre ...