第一题,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. Pre- and Post-order Traversals(先序+后序序列,建立二叉树)

    PAT甲级1119,我先在CSDN上面发布的这篇文章:https://blog.csdn.net/weixin_44385565/article/details/89737224 Suppose th ...

  2. P1147 连续自然数和(思维题)

    题目描述 对一个给定的自然数MM,求出所有的连续的自然数段,这些连续的自然数段中的全部数之和为MM. 例子:1998+1999+2000+2001+2002 = 100001998+1999+2000 ...

  3. Experimental Educational Round: VolBIT Formulas Blitz A

    Description The HR manager was disappointed again. The last applicant failed the interview the same ...

  4. 1040 有几个PAT (25 分

    字符串 APPAPT 中包含了两个单词 PAT,其中第一个 PAT 是第 2 位(P),第 4 位(A),第 6 位(T):第二个 PAT 是第 3 位(P),第 4 位(A),第 6 位(T). 现 ...

  5. ubuntu下用apt-get安装lamp缺少mcrypt , curl

    用apt-get安装的LAMP环境,但安装magento报没有mcrypt和curl,   解决方法如下: curl安装: sudo apt-get install curl libcurl3 lib ...

  6. 那些NPM文档中我看不懂地方

    $cookies.set(keyName, value[, expireTimes[, path[, domain[, secure]]]]) //return this 中括号代表可选参数 上面一行 ...

  7. MQTT学习之一

    一MQTT特性: 基于C/S,发布订阅(发布者服务器->云平台代理->订阅客户端)一对多结构,适用于低带宽高延时,基于TCP/IP之上.

  8. 性能测试工具Jmeter01-简介

    Jmeter介绍: Apache JMeter是Apache组织的开放源代码项目,是一个纯Java桌面应用,用于压力测试和性能测试.最初被设计用于Web应用测试后来扩展到其它测试领域 Jmeter有啥 ...

  9. RNN学习资料

    1. Recurrent Neural Networks Tutorial, Part 2 – Implementing a RNN with Python, Numpy and Theano htt ...

  10. 案例51-crm练习新增客户使用数据字典和ajax

    1 案例效果 2 使用ajax加载数据字典下拉选-后台部分 1 domain部分-BaseDict package www.test.domain; public class BaseDict { / ...