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 ...
随机推荐
- 伪类选择器 :nth-child(even) :nth-child(odd) :nth-of-type
属性 描述 CSS :active 向被激活的元素添加样式. 1 :focus 向拥有键盘输入焦点的元素添加样式. 2 :hover 当鼠标悬浮在元素上方时,向元素添加样式. 1 :link 向未被访 ...
- Candies
Candies Time Limit: 1500MS Memory Limit: 131072K Total Submissions: 30247 Accepted: 8409 Descrip ...
- FISCO BCOS WorkShop | 区块链开发特训营,开课啦!
FISCO BCOS是完全开源的联盟区块链底层技术平台,由金融区块链合作联盟(深圳)(简称金链盟)成立开源工作组通力打造.开源工作组成员包括博彦科技.华为.深证通.神州数码.四方精创.腾讯.微众银行. ...
- Beanshell vs JSR223 vs Java JMeter脚本:性能关闭你一直在等待!
有几个选项可用于执行自定义JMeter脚本并扩展基线JMeter功能.查看最流行的扩展机制,比较性能并分析哪一个是最好的. 这是乐队之战,JMeter风格. Beanshell V. JSR223 V ...
- XmlSerilizer序列化出错时,不妨考虑BinaryFormatter
当你使用XmlSerilizer序列化一个结构复杂的类型时出现反射出错 XmlSerilizer并不会告诉你哪个字段属性或者嵌套的字段属性不能被序列号,面对多年前的代码逐一排查很恼人使用BinaryF ...
- JavaScript读取文本,并渲染在html
html <pre id="myText" style="word-wrap: break-word; white-space: pre-wrap; white-s ...
- (转)Linux内核参数设置sysctl命令详解
Linux内核参数设置sysctl命令详解 原文:https://www.zhukun.net/archives/8064 sysctl是一个允许您改变正在运行中的Linux系统的接口. 它包含一些 ...
- 单周期cpu设计代码解读
目录 写在前面 单周期cpu设计代码讲解 概念回顾 Verilog代码讲解 写在前面 欢迎转载,转载请说明出处. 单周期cpu设计代码讲解 概念回顾 一.电子计算机的部件 分为:中央处理器(cpu). ...
- hubbledotnet 使用笔记
Hubble vs 字符串 <connectionStrings> <add name="Search" connectionString="serve ...
- JVM垃圾回收机制四
GCRoots与可达性分析 Java中的四种引用 强引用.软引用.弱引用.虚引用.这四种引用的强度是逐渐减弱的,JVM垃圾回收的力度是逐渐增强的. 四种引用的作用 1.可以让程序员通过代码来控制对象的 ...