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题

  1. #define HDU
  2. #ifndef HDU
  3. #include<bits/stdc++.h>
  4. #else
  5. #include<cstdio>
  6. #include<cmath>
  7. #include<vector>
  8. #include<map>
  9. #include<set>
  10. #include<algorithm>
  11. #include<cstring>
  12. #endif // HDU
  13. using namespace std;
  14. //const int maxn = 1009;
  15. //int n;
  16. //int a[maxn];
  17. int main()
  18. {
  19. #ifdef local
  20. freopen("in.txt","r",stdin);
  21. //freopen("out.txt","w",stdout);
  22. #endif // local
  23. int t;
  24. int n;
  25. while(~scanf("%d",&n)){
  26. bool flag = ;
  27. for(int i = ; i < n; i++){
  28. scanf("%d",&t);
  29. if(t == ) flag = ;
  30.  
  31. }
  32. if(flag) printf("-1");
  33. else printf("");
  34. }
  35. return ;
  36. }
  37.  
  38. /*
  39. // for(int i = 0; i < n; i++){
  40. //}
  41.  
  42. scanf("%d",a+i);
  43. sort(a,a+n);
  44. if(a[0] == 1 ){
  45.  
  46. }else
  47. */

B题

  1. #define HDU
  2. #ifndef HDU
  3. #include<bits/stdc++.h>
  4. #else
  5. #include<cstdio>
  6. #include<cmath>
  7. #include<vector>
  8. #include<map>
  9. #include<set>
  10. #include<algorithm>
  11. //#include<iostream>
  12. #endif // HDU
  13. using namespace std;
  14.  
  15. //#define local
  16. #define PY { puts("YES"); return 0; }
  17. #define PN { puts("NO"); return 0; }
  18.  
  19. int main()
  20. {
  21. #ifdef local
  22. freopen("in.txt","r",stdin);
  23. //freopen("out.txt","w",stdout);
  24. #endif // local
  25. int a0,b0;
  26. scanf("%d%d",&a0,&b0);
  27. int a1,b1,a2,b2;
  28. scanf("%d%d%d%d",&a1,&b1,&a2,&b2);
  29. int t = (a1+a2),t2 = max(b1,b2);
  30. if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
  31. t = (a1+b2); t2 = max(b1,a2);
  32. if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
  33. t = (b1+a2); t2 = max(a1,b2);
  34. if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
  35. t = (b1+b2); t2 = max(a1,a2);
  36. if((t<=a0 && t2<= b0)|| (t<=b0 && t2<=a0) ) PY;
  37. PN;
  38. return ;
  39. }

C题

  1. #define HDU
  2. #ifndef HDU
  3. #include<bits/stdc++.h>
  4. #else
  5. #include<cstdio>
  6. #include<cmath>
  7. #include<vector>
  8. #include<map>
  9. #include<set>
  10. #include<algorithm>
  11. //#include<iostream>
  12. #endif // HDU
  13. using namespace std;
  14.  
  15. //#define local
  16.  
  17. int main()
  18. {
  19. #ifdef local
  20. freopen("in.txt","r",stdin);
  21. //freopen("out.txt","w",stdout);
  22. #endif // local
  23. int a,b,c,d,e,f,g;
  24. scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g);
  25. int l = a+b+c;
  26. int ans = l*l - a*a - c*c - e*e;
  27. printf("%d",ans);
  28. return ;
  29. }

D题

  1. #define HDU
  2. #ifndef HDU
  3. #include<bits/stdc++.h>
  4. #else
  5. #include<cstdio>
  6. #include<cmath>
  7. #include<vector>
  8. #include<map>
  9. #include<set>
  10. #include<algorithm>
  11. #include<cstring>
  12. #endif // HDU
  13. using namespace std;
  14.  
  15. //#define local
  16.  
  17. bool dfs(char *a,int len,char *b)
  18. {
  19. if(len == ) { return (*a) == (*b); }
  20. if(memcmp(a,b,len) == ) return true;
  21. if(len&) return false;
  22. len >>= ;
  23. return (dfs(a,len,b+len) && dfs(a+len,len,b))||(dfs(a+len,len,b+len) && dfs(a,len,b));
  24. }
  25.  
  26. const int maxn = +;
  27. char a[maxn],b[maxn];
  28.  
  29. int main()
  30. {
  31. #ifdef local
  32. freopen("in.txt","r",stdin);
  33. //freopen("out.txt","w",stdout);
  34. #endif // local
  35. scanf("%s%s",a,b);
  36. int len = strlen(a);
  37. printf("%s\n",dfs(a,len,b)?"YES":"NO");
  38. return ;
  39. }

Codeforces Round #313 (Div. 2) A.B,C,D,E Currency System in Geraldion Gerald is into Art Gerald's Hexagon Equivalent Strings的更多相关文章

  1. 【打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 ...

  2. 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 ...

  3. 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 ...

  4. Codeforces Round #313 (Div. 1) B. Equivalent Strings

    Equivalent Strings Problem's Link: http://codeforces.com/contest/559/problem/B Mean: 给定两个等长串s1,s2,判断 ...

  5. 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/ ...

  6. Codeforces Round #313 (Div. 2) D. Equivalent Strings

    D. Equivalent Strings Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/ ...

  7. 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 ...

  8. 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 ...

  9. 【打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 ...

随机推荐

  1. codevs1553 互斥的数

    1553 互斥的数    

  2. django后台管理系统(admin)的简单使用

    目录 django后台管理系统的使用 检查配置文件 检查根urls.py文件 启动项目,浏览器输入ip端口/admin 如: 127.0.0.1/8000/admin 回车 注册后台管理系统超级管理 ...

  3. maven工程运行出Unable to compile class for JSP: 错误

    使用mvn tomcat:run运行时出现500错误,使用tomcat7再次运行就好了 更新,上面的是在命令行操作的 如果要在idea上面出现错误的话需要在pom.xml上配置下面的语句 org.ap ...

  4. Jar命令用法

    JAR文件 JAR文件 全称:Java Archive File , 意思是Java档案文件.通常JAR文件是一种压缩文件,与常见的ZIP压缩文件兼容,通常被称为JAR包. JAR文件和ZIP文件的区 ...

  5. JS 对象的操作方法

    第一种: 变量名.style.属性: 第二种: 变量名.style[参数]

  6. JavaScript基础学习日志(1)——属性操作

    JS中的属性操作: 属性操作语法 属性读操作:获取 实例:获取Input值 实例:获取select值 字符串连接 属性写操作:修改.添加 实例:修改value值 实例:添加图片的src地址 inner ...

  7. Kestrel服务器启动并处理Http请求

    从Hosting开始   知识点: 1.Kestrel服务器启动并处理Http请求的过程. 2.Startup的作用. 源码飘香: 总结: asp.net core将web开发拆分为多个独立的组件,大 ...

  8. 关于FutureTask的探索

    之前关于Java线程的时候,都是通过实现Runnable接口或者是实现Callable接口,前者交给Thread去run,后者submit到一个ExecutorService去执行. 然后知道了还有个 ...

  9. D. Restructuring Company 并查集 + 维护一个区间技巧

    http://codeforces.com/contest/566/problem/D D. Restructuring Company time limit per test 2 seconds m ...

  10. Oracle批量SQL之 BULK COLLECT 子句

    BULK COLLECT 子句会批量检索结果,即一次性将结果集绑定到一个集合变量中,并从SQL引擎发送到PL/SQL引擎.通常可以在SELECT INTO.FETCH INTO以及RETURNING ...