Codeforces Round #313 (Div. 2) A.B,C,D,E Currency System in Geraldion Gerald is into Art Gerald's Hexagon Equivalent Strings
A题,超级大水题,根据有没有1输出-1和1就行了。我沙茶,把%d写成了%n。
B题,也水,两个矩形的长和宽分别加一下,剩下的两个取大的那个,看看是否框得下。
C题,其实也很简单,题目保证了小三角形是正三角形,一个正三角的面积=l*l*(1/2)*cos(30),由于只要算三角形个数,把六边形扩成一个大三角,剪掉三个小三角,除一下系数就没了。就变成了平方相减。
D题,根据定义递归。然后注意奇数就行了。我沙茶,没加第一种判断dfs(a+len,len,b+len) && dfs(a,len,b)。
E题,有思路,没写代码,就是个DP,设当前走到r,c且不经过黑点的方案数为dp[r][c],转移的时候用C(r+c-2,r-1)可以算出从(0,0)点走到(r,c)的方案数,然后减去从之前的黑点走到(r,c)的方案数。
总结,好好读题,仔细敲代码
A题
#define HDU
#ifndef HDU
#include<bits/stdc++.h>
#else
#include<cstdio>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<cstring>
#endif // HDU
using namespace std;
//const int maxn = 1009;
//int n;
//int a[maxn];
int main()
{
#ifdef local
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // local
int t;
int n;
while(~scanf("%d",&n)){
bool flag = ;
for(int i = ; i < n; i++){
scanf("%d",&t);
if(t == ) flag = ; }
if(flag) printf("-1");
else printf("");
}
return ;
} /*
// for(int i = 0; i < n; i++){
//} scanf("%d",a+i);
sort(a,a+n);
if(a[0] == 1 ){ }else
*/
B题
#define HDU
#ifndef HDU
#include<bits/stdc++.h>
#else
#include<cstdio>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
//#include<iostream>
#endif // HDU
using namespace std; //#define local
#define PY { puts("YES"); return 0; }
#define PN { puts("NO"); return 0; } int main()
{
#ifdef local
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // local
int a0,b0;
scanf("%d%d",&a0,&b0);
int a1,b1,a2,b2;
scanf("%d%d%d%d",&a1,&b1,&a2,&b2);
int t = (a1+a2),t2 = max(b1,b2);
if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
t = (a1+b2); t2 = max(b1,a2);
if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
t = (b1+a2); t2 = max(a1,b2);
if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
t = (b1+b2); t2 = max(a1,a2);
if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
PN;
return ;
}
C题
#define HDU
#ifndef HDU
#include<bits/stdc++.h>
#else
#include<cstdio>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
//#include<iostream>
#endif // HDU
using namespace std; //#define local int main()
{
#ifdef local
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // local
int a,b,c,d,e,f,g;
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g);
int l = a+b+c;
int ans = l*l - a*a - c*c - e*e;
printf("%d",ans);
return ;
}
D题
#define HDU
#ifndef HDU
#include<bits/stdc++.h>
#else
#include<cstdio>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<cstring>
#endif // HDU
using namespace std; //#define local bool dfs(char *a,int len,char *b)
{
if(len == ) { return (*a) == (*b); }
if(memcmp(a,b,len) == ) return true;
if(len&) return false;
len >>= ;
return (dfs(a,len,b+len) && dfs(a+len,len,b))||(dfs(a+len,len,b+len) && dfs(a,len,b));
} const int maxn = +;
char a[maxn],b[maxn]; int main()
{
#ifdef local
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // local
scanf("%s%s",a,b);
int len = strlen(a);
printf("%s\n",dfs(a,len,b)?"YES":"NO");
return ;
}
Codeforces Round #313 (Div. 2) A.B,C,D,E Currency System in Geraldion Gerald is into Art Gerald's Hexagon Equivalent Strings的更多相关文章
- 【打CF,学算法——一星级】Codeforces Round #313 (Div. 2) A. Currency System in Geraldion
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/A 题面: A. Currency System in Geraldion time l ...
- Codeforces Round #313 (Div. 2) A. Currency System in Geraldion
A. Currency System in Geraldion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...
- Codeforces Round #313 (Div. 2) A. Currency System in Geraldion 水题
A. Currency System in Geraldion Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/c ...
- Codeforces Round #313 (Div. 1) B. Equivalent Strings
Equivalent Strings Problem's Link: http://codeforces.com/contest/559/problem/B Mean: 给定两个等长串s1,s2,判断 ...
- Codeforces Round #313 (Div. 2)B.B. Gerald is into Art
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/ ...
- Codeforces Round #313 (Div. 2) D. Equivalent Strings
D. Equivalent Strings Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/ ...
- Codeforces Round #313 (Div. 1) B. Equivalent Strings DFS暴力
B. Equivalent Strings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559 ...
- Codeforces Round #313 (Div. 2) B. Gerald is into Art 水题
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/560 ...
- 【打CF,学算法——二星级】Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/B 题面: B. Gerald is into Art time limit per t ...
随机推荐
- 34.Docker安装Mysql参数及环境变量使用
容器安装好后,通过exec进去到容器的内部, 容器安装的时候两种容器配置参数 直接在镜像的后面加配置 第二种方式 把这段代码拷贝过来.参数我们可以写在镜像的后面 我们把参数写在镜像的后面 然后我们需要 ...
- ue4学习资料
官网中文 https://docs.unrealengine.com/latest/CHN/index.html 官网英文 https://docs.unrealengine.com/latest/I ...
- 【转】PHP实现下载与压缩文件的封装与整理
[转]PHP实现下载与压缩文件的封装与整理 https://mp.weixin.qq.com/s/BUI3QsdNi6Nqu0NhrUL8hQ 一.PHP实现打包zip并下载功能 $file_t ...
- poj2241 The Tower of Babylon
The Tower of Babylon 题意:给你n种石头,长x,宽y,高z,每种石头数目无限,一块石头能放到另一块上的条件是:长和宽严格小于下面的石头.问叠起来的最大高度. /* 有些类似“叠箱子 ...
- jzoj6009. 【THUWC2019模拟2019.1.18】Counting (dp)
Description 羽月最近发现,她发动能力的过程是这样的: 构建一个 V 个点的有向图 G,初始为没有任何边,接下来羽月在脑中构建出一个长度为 E 的边的序列,序列中元素两两不同,然后羽月将这些 ...
- 关于spring的简概
一.Spring入门操作 IOC 创建对象 <bean id="user" class="com.itheima.domain.User">< ...
- NOIp2013 火柴排队【逆序对/思维】 By cellur925
题目大意:给你两列数\(ai\)和\(bi\),你可以交换每列数中相邻的两个数,求一个最小交换次数使\(\sum_{i=1}^{n}(a_i-b_i)^2\) 最小. 最后满足条件的两个序列一定是各个 ...
- React中方法的this绑定
第一种 在组件(类)的constructor中绑定this class Demo extends Component { constructor(this) { super(this) this.st ...
- 黑马旅游网案例 Bug集锦
- java模拟多线程
public class HTTPRequest implements Runnable { public void run() { //这里实现发送请求 } public static void ...