第一题,http://community.topcoder.com/stat?c=problem_statement&pm=13462&rd=16076

模拟就可以了。

#include <vector>
#include <algorithm> using namespace std; class Target {
public:
vector <string> draw(int n) {
vector<string> result(n, string(n, ' '));
int x = 0;
int y = 0;
while (n >= 1) {
for (int i = 0; i < n; i++) {
result[x + i][y] = '#';
result[x][y + i] = '#';
result[x + n - 1][y + i] = '#';
result[x + i][y + n - 1] = '#';
}
x += 2;
y += 2;
n -= 4;
}
return result;
}
};

第二题,想了很久。最后发现用三角形的A+B>=C,一个一个推,可以推出N条边所组成的多边形(开口)的距离范围。http://apps.topcoder.com/wiki/display/tc/SRM+633#Jumping

有详细的图示。

#include <vector>
#include <algorithm>
#include <string>
#include <algorithm>
using namespace std; class Jumping {
public:
string ableToGet(int x, int y, vector <int> jumpLengths) {
double d = sqrt(1.0 * x * x + 1.0 * y * y);
sort(jumpLengths.begin(), jumpLengths.end());
double low = jumpLengths[0];
double high = jumpLengths[0];
for (int i = 1; i < jumpLengths.size(); i++) {
low = max(0.0, jumpLengths[i] - high);
high = high + jumpLengths[i];
}
if (d >= low && d <= high) {
return "Able";
} else {
return "not able";
} } };

第三题,没做。后来看题解,就是用LCD和GCD的限制,得到x*y,然后穷举搜索。用DFS。

[topcoder]SRM 633 DIV 2的更多相关文章

  1. TopCoder SRM 633 Div.2 500 Jumping

    题意:给一个点(x,y),给一些步长delta1,delta2...deltaN,问从(0,0)严格按照步长走完N步后能否正好到达(x,y)点. 解法:其实就是判断这些线段和(0,0)-(x,y)这条 ...

  2. TopCoder SRM 560 Div 1 - Problem 1000 BoundedOptimization & Codeforces 839 E

    传送门:https://284914869.github.io/AEoj/560.html 题目简述: 定义"项"为两个不同变量相乘. 求一个由多个不同"项"相 ...

  3. TopCoder SRM 667 Div.2题解

    概览: T1 枚举 T2 状压DP T3 DP TopCoder SRM 667 Div.2 T1 解题思路 由于数据范围很小,所以直接枚举所有点,判断是否可行.时间复杂度O(δX × δY),空间复 ...

  4. [topcoder]SRM 646 DIV 2

    第一题:K等于1或者2,非常简单.略.K更多的情况,http://www.cnblogs.com/lautsie/p/4242975.html,值得思考. 第二题:http://www.cnblogs ...

  5. TopCoder SRM 596 DIV 1 250

    body { font-family: Monospaced; font-size: 12pt } pre { font-family: Monospaced; font-size: 12pt } P ...

  6. Topcoder SRM 656 (Div.1) 250 RandomPancakeStack - 概率+记忆化搜索

    最近连续三次TC爆零了,,,我的心好痛. 不知怎么想的,这题把题意理解成,第一次选择j,第二次选择i后,只能从1~i-1.i+1~j找,其实还可以从j+1~n中找,只要没有被选中过就行... [题意] ...

  7. Topcoder SRM 648 (div.2)

    第一次做TC全部通过,截图纪念一下. 终于蓝了一次,也是TC上第一次变成蓝名,下次就要做Div.1了,希望div1不要挂零..._(:зゝ∠)_ A. KitayutaMart2 万年不变的水题. # ...

  8. 【topcoder SRM 702 DIV 2 250】TestTaking

    Problem Statement Recently, Alice had to take a test. The test consisted of a sequence of true/false ...

  9. TopCoder SRM 639 Div.2 500 AliceGameEasy

    题意: 一个游戏有n轮,有A和B比赛,谁在第 i 轮得胜,就获得 i 分,给出x,y,问A得x分,B得y分有没有可能,如果有,输出A最少赢的盘数 解题思路: 首先判断n(n+1)/2 = (x+y)是 ...

随机推荐

  1. js获取复选框内容

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script sr ...

  2. 【STL基础】vector

    vector 构造函数: //default: vector<T> v; //空的vector //fill: vector<T> v(n); //n个元素的vector,元素 ...

  3. ubuntu 16 64位编译安装php

    ./configure \ --prefix=/usr/local/php7 \ --exec-prefix=/usr/local/php7 \ --with-config-file-path=/us ...

  4. Ubuntu系统中连接TFS的Git地址注意事项

    在Ubuntu中安装Git后,配置远程Git服务器地址,如果是TFS的Git仓库地址,则需要使用IP地址,否则可能出现识别不出来的问题; 再者,如果你想要在Ubuntu的浏览中访问TFS的Git仓库U ...

  5. 配置MapReduce程序运行环境

    已安装eclipse,hadoop 查看教程dblab.xmu.edu.cn/blog/hadoop-build-project-using-eclipse/

  6. python -- Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    用python读取hive数据,引用下面包. #!/usr/bin/env python import pyhs2 as hive 先按照它 pip install pyhs2 出现错误 Collec ...

  7. Boxes in a Line UVA - 12657 (双向链表)

    题目链接:https://vjudge.net/problem/UVA-12657 题目大意:输入n,m  代表有n个盒子 每个盒子最开始按1~n排成一行  m个操作, 1 x y  :把盒子x放到y ...

  8. 正则表达式获取多个img src的值

    /** * 得到网页中图片的地址 */public static Set<String> getImgStr(String htmlStr) { Set<String> pic ...

  9. 手机缺失sqlite3时操作数据库的多种解决方案 ----adb命令科普

    在Android应用开发无处不在SQLite数据库的身影.那么在开发中怎么使用adb命令操作数据库的功能呢? 下面我们将完整的介绍与数据库操作相关的命令集及当手机缺少sqlite3的时候的多种解决方案 ...

  10. redis数据类型及常用命令使用

    redis干啥的,一般人都知道,但很多人只知道是个缓存数据库,其它的就不知道了,本猿无能亦是如此,然知耻而后勇,我们该理一理这里边的一些逻辑,看看redis究竟是怎么一回事儿,能干啥,怎么做的,这样才 ...