网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
10月25日漏签0天
c++吧 关注:639,234贴子:2,116,001
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 6回复贴,共1页
<<返回c++吧
>0< 加载中...

c++金题贴(强烈要求吧主顶置)

  • 只看楼主
  • 收藏

  • 回复
  • 龙天命
  • ?:
    4
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


  • 龙天命
  • ?:
    4
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
请大家把自己遇到的有趣的题贴出来 供大家交流


2025-10-25 19:12:49
广告
不感兴趣
开通SVIP免广告
  • 龙天命
  • ?:
    4
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Problem Statement 
???? 
You are given a String[] cityMap representing the layout of a city. The city 
consists of blocks. The first element of cityMap represents the first row of 
blocks, etc. A 'B' character indicates a location where there is a bus stop. 
There will be exactly one 'X' character, indicating your location. All other 
characters will be '.'. You are also given an int walkingDistance, which is the 
maximum distance you are willing to walk to a bus stop. The distance should be 
calculated as the number of blocks vertically plus the number of blocks 
horizontally. Return the number of bus stops that are within walking distance of 
your current location. Definition 
???? 
Class: 
BusStops 
Method: 
countStops 
Parameters: 
String[], int 
Returns: 
int 
Method signature: 
int countStops(String[] cityMap, int walkingDistance) 
(be sure your method is public) 
???? 
Constraints 
- 
cityMap will contain between 1 and 50 elements, inclusive. 
- 
Each element of cityMap will contain between 1 and 50 characters, inclusive. 
- 
Each element of cityMap will contain the same number of characters. 
- 
Each character of each element of cityMap will be 'B', 'X', or '.'. 
- 
There will be exactly one 'X' character in cityMap. 
- 
walkingDistance will be between 1 and 100, inclusive. 
Examples 
0) 
???? 
{"...B.", 
 ".....", 
 "..X.B", 
 ".....", 
 "B...."} 
3 
Returns: 2 
You can reach the bus stop at the top (3 units away), or on the right (2 units 
away). The one in the lower left is 4 units away, which is too far. 1) 
???? 
{"B.B..", 
 ".....", 
 "B....", 
 ".....", 
 "....X"} 
8 
Returns: 3 
A distance of 8 can get us anywhere on the map, so we can reach all 3 bus stops. 
2) 
???? 
{"BBBBB", 
 "BB.BB", 
 "B.X.B", 
 "BB.BB", 
 "BBBBB"} 
1 
Returns: 0 
Plenty of bus stops, but unfortunately we cannot reach any of them. 
3) 
???? 
{"B..B..", 
 ".B...B", 
 "..B...", 
 "..B.X.", 
 "B.B.B.", 
 ".B.B.B"} 
3 
Returns: 7 
This problem statement is the exclusive and proprietary property of TopCoder, 
Inc. Any unauthorized use or reproduction of this information without the prior 
written consent of TopCoder, Inc. is strictly prohibited. ?2003, TopCoder, 
Inc. All rights reserved.


  • 龙天命
  • ?:
    4
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
1.我们平常玩得扑克牌随便抽出一个色的全部牌(1-13),我们来定制这样一个规则:假如已经排好序,当然现在我们现在看的是他们的背面,即是不知道牌的大小,现在把最上面的一个放到底部,然后抽出现在最上面的一张,看正面,是1,扔掉1,拿一张再到底部,再看第一张,是2,扔掉,就这样下去,3,4,5。。。。。13,好,就这样,用算法实现那个已经排好顺序的扑克牌的顺序!
2.有1到10个人,编号分别为1-10,现在我们先让1站出来,然后隔两个再站出一位,即是4,继续下去,最后当最后一位出来时,用算法实现出来的顺序


  • 龙天命
  • ?:
    4
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
咋就没人喜欢c++的题呢 你们都去哪搞趣题呢


  • 无尾兽零号机
  • ,
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
MFC做资源管理器、注册表编辑器、FTP客户端的题最有趣,涉及到大量算法,特别是再移植到GCC(Win下),重写所有代码,更有趣~!


  • 无尾兽零号机
  • ,
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
不是吗?


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 6回复贴,共1页
<<返回c++吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示