博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #313 (Div. 2) A.B,C,D,E Currency System in Geraldion Gerald is into Art Ger...
阅读量:6931 次
发布时间:2019-06-27

本文共 3229 字,大约阅读时间需要 10 分钟。

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
#else#include
#include
#include
#include
#include
#include
#include
#endif // HDUusing 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 = 0; for(int i = 0; i < n; i++){ scanf("%d",&t); if(t == 1) flag = 1; } if(flag) printf("-1"); else printf("1"); } return 0;}/* // for(int i = 0; i < n; i++){ //} scanf("%d",a+i); sort(a,a+n); if(a[0] == 1 ){ }else*/
View Code

B题

#define HDU#ifndef HDU#include
#else#include
#include
#include
#include
#include
#include
//#include
#endif // HDUusing 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 0;}
View Code

C题

#define HDU#ifndef HDU#include
#else#include
#include
#include
#include
#include
#include
//#include
#endif // HDUusing namespace std;//#define localint 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 0;}
View Code

D题

#define HDU#ifndef HDU#include
#else#include
#include
#include
#include
#include
#include
#include
#endif // HDUusing namespace std;//#define localbool dfs(char *a,int len,char *b){ if(len == 1) { return (*a) == (*b); } if(memcmp(a,b,len) == 0) return true; if(len&1) return false; len >>= 1; return (dfs(a,len,b+len) && dfs(a+len,len,b))||(dfs(a+len,len,b+len) && dfs(a,len,b));}const int maxn = 200000+5;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 0;}
View Code

 

转载于:https://www.cnblogs.com/jerryRey/p/4669862.html

你可能感兴趣的文章
深度学习及机器学习框架对比摘要
查看>>
【转】Oracle 自定义函数语法与实例
查看>>
013-提升状态
查看>>
Office 2016 安装你所必须要注意的事项
查看>>
MonolithFirst
查看>>
java.lang.IllegalArgumentException: Request header is too large 解决方案
查看>>
Word在转PDF的过程中如何创建标签快速方便阅读(图文详解)
查看>>
python字符串(string)方法整理
查看>>
amazeui时间组件测试
查看>>
《数据科学家访谈录》读书笔记
查看>>
jsp 获取服务器ip 以及端口号
查看>>
使用 Laravel-Excel 进行 CSV/EXCEL 文件读写
查看>>
[Vue-rx] Disable Buttons While Data is Loading with RxJS and Vue.js
查看>>
整合使用持久层框架mybatis 使用SqlSessionTemplate模板类与使用映射接口 对比
查看>>
Service Mesh服务网格:是什么和为什么
查看>>
ASP.NET Aries 高级开发教程:Excel导入之代码编写(番外篇)
查看>>
Node.js 使用JWT进行用户认证
查看>>
phpstorm快捷键小结
查看>>
关于用wkwebview加载沙盒documents下html文件 模拟器可以,真机不行的解决方案
查看>>
.NET的前世今生与将来
查看>>