[topcoder]SRM 633 DIV 2
第一题,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的更多相关文章
- TopCoder SRM 633 Div.2 500 Jumping
题意:给一个点(x,y),给一些步长delta1,delta2...deltaN,问从(0,0)严格按照步长走完N步后能否正好到达(x,y)点. 解法:其实就是判断这些线段和(0,0)-(x,y)这条 ...
- TopCoder SRM 560 Div 1 - Problem 1000 BoundedOptimization & Codeforces 839 E
传送门:https://284914869.github.io/AEoj/560.html 题目简述: 定义"项"为两个不同变量相乘. 求一个由多个不同"项"相 ...
- TopCoder SRM 667 Div.2题解
概览: T1 枚举 T2 状压DP T3 DP TopCoder SRM 667 Div.2 T1 解题思路 由于数据范围很小,所以直接枚举所有点,判断是否可行.时间复杂度O(δX × δY),空间复 ...
- [topcoder]SRM 646 DIV 2
第一题:K等于1或者2,非常简单.略.K更多的情况,http://www.cnblogs.com/lautsie/p/4242975.html,值得思考. 第二题:http://www.cnblogs ...
- TopCoder SRM 596 DIV 1 250
body { font-family: Monospaced; font-size: 12pt } pre { font-family: Monospaced; font-size: 12pt } P ...
- Topcoder SRM 656 (Div.1) 250 RandomPancakeStack - 概率+记忆化搜索
最近连续三次TC爆零了,,,我的心好痛. 不知怎么想的,这题把题意理解成,第一次选择j,第二次选择i后,只能从1~i-1.i+1~j找,其实还可以从j+1~n中找,只要没有被选中过就行... [题意] ...
- Topcoder SRM 648 (div.2)
第一次做TC全部通过,截图纪念一下. 终于蓝了一次,也是TC上第一次变成蓝名,下次就要做Div.1了,希望div1不要挂零..._(:зゝ∠)_ A. KitayutaMart2 万年不变的水题. # ...
- 【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 ...
- 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)是 ...
随机推荐
- Qt 学习之路 2(5):自定义信号槽
Home / Qt 学习之路 2 / Qt 学习之路 2(5):自定义信号槽 Qt 学习之路 2(5):自定义信号槽 豆子 2012年8月24日 Qt 学习之路 2 131条评论 上一节我们详 ...
- react 部分语法补充
jsx语法 todolist.js import React, { Component,Fragment } from 'react'; import './style.css' class Todo ...
- Experimental Educational Round: VolBIT Formulas Blitz F
Description One company of IT City decided to create a group of innovative developments consisting f ...
- 工具类_IsNull
import java.util.List; /** * 判断是否为空 2015-08-17 * * @author lipanquan * */public final class IsNull ...
- 停止mysql服务
停止mysql服务windowsnet stop mysql (service mysqld stop win10不能用) linux /etc/init.d/mysqld stop
- NETCore 调试
https://www.cnblogs.com/MingQiu/p/8227644.html https://www.cnblogs.com/shumin/p/9967854.html 前言 core ...
- python发送微信
申请企业微信 使用python发送信息到企业微信,同时支持python2与python3环境,需要先申请一个企业微信,然后创建应用,获取以下三个信息 企业IP.Agentid.Secret 网信为创建 ...
- SpringMVC---彻底解决/和/*的问题!到底该用哪一个?
出处: https://blog.csdn.net/sinat_33921105/article/details/81951156 在web开发中我们经常会遇到/和/*的问题,有的时候稍不注意就容易忘 ...
- leetcode 892. 三维形体的表面积
题目描述: 在 N * N 的网格上,我们放置一些 1 * 1 * 1 的立方体. 每个值 v = grid[i][j] 表示 v 个正方体叠放在单元格 (i, j) 上. 返回最终形体的表面积. ...
- redis的三种启动方式,个人常用第二种
redis的启动方式1.直接启动 进入redis根目录,执行命令: #加上‘&’号使redis以后台程序方式运行 1 ./redis-server & 2.通过指定配置文件启动 ...