这个题我们又把题意理解错了,队友翻译了以后给我解释,我问这个直接一个单词开头的是要找到这个文件夹吗,他说是,然后我就呵呵了..奔着树形结构去和字符串维护就去了...做了好久都没模拟出来,感觉做出来的人也牛了..重名问题怎么解决的啊....但是!!!! 其实没有那么复杂,题目中总共有三种情况:以"/"开头是指新建一个根目录,以前清空就行了,".."是返回上一层的文件夹,"单词开头"就是在停在的文件夹处建立这个单词所描述的文件夹,可以与父亲重名.与常…
C. Cd and pwd commands Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/158/C Description Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he dec…
执行命令来改变路径 cd 并显示路径命令 pwd 一个节目的 抽样: input 7 pwd cd /home/vasya pwd cd .. pwd cd vasya/../petya pwd output / /home/vasya/ /home/ /home/petya/ 原题: http://codeforces.com/problemset/problem/158/C 考点: 操作字符串 -- 使用C++特别难的,好像java和C#都特别easy.只是使用C++能够清楚每个细节的操作…
Cd and pwd commands time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he…
[链接] 我是链接,点我呀:) [题意] 让你实现Shell的cd和pwd操作 [题解] 用一个list表示当前的路径 如果路径以/开头则表示需要清空当前路径重新走路 否则在原来路径的基础上继续加就可以了 [代码] import java.io.*; import java.util.*; public class Main { static InputReader in; static PrintWriter out; public static void main(String[] args…
题目链接 题意很清楚 和linux的语句是一样的 pwd输出路径 cd进入 ..回上一层目录 此题完全是string的应用 String的用法 vector<string> s; int main() { int n; scanf("%d", &n); while(n--) { string cd; cin>>cd; if(cd=="pwd") { printf("/"); ;i<s.size();i++)…
题意 https://vjudge.net/problem/CodeForces-158C 你需要实现类似 Unix / Linux 下的 cd 和 pwd 命令. 一开始,用户处于根目录 / 下. 对于 cd 命令,它的作用是跳转到某个路径.路径有相对路径和绝对路径,相对路径以文件夹名开头,表示当前目录下的文件夹,绝对路径以 / 开头,表示根目录下的文件夹.同时,.. 文件夹表示上一层文件夹. 对于 pwd 命令,你需要输出当前所在的绝对路径. 保证输入数据中所有的文件夹都存在. 思路 用栈记…
cd.pwd.mkdir.rmdir 命令功能: 切换到指定的目录,可用绝对路径和相对路径 命令格式: cd directory 命令参数: 无 命令实例: 1.切换到/bin目录 vbird@Ubuntu1604:~$ pwd /home/vbird vbird@Ubuntu1604:~$ cd /bin/ vbird@Ubuntu1604:/bin$ pwd /bin 2.切换到自己的主文件夹 vbird@Ubuntu1604:/bin$ pwd /bin vbird@Ubuntu1604:…
C. Shockers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Valentin participates in a show called "Shockers". The rules are quite easy: jury selects one letter which Valentin doesn't…
前言 从本篇文章开始,每篇文章将写10个Linux命令,个人的写作想法是: 1.常用的Linux命令,那些生僻的.不常用的就不写了 2.从实际考虑,只列出每个命令常见的用法和参数选项,有兴趣了解进一步的用法可以自己上网去查询 vi Linux环境下的文本编辑器 vi基本上可以分为三种操作状态,分别是命令模式.插入模式.底线命令模式,各功能的功能区分如下: 1.命令模式 控制屏幕光标的移动,字符或光标的删除,移动复制某区段及进入插入模式 2.插入模式 只有在插入模式下,才可以做文字数据输入,按ES…
题目链接:http://codeforces.com/problemset/problem/723/B 题目大意: 输入n,给出n个字符的字符串,字符串由 英文字母(大小写都包括). 下划线'_' .括号'(' ')' 组成.[括号不会嵌套] 求括号外面的连续字符串最大的字符串长度和括号内的连续字符串的个数. 举例: input 37_Hello_Vasya(and_Petya)__bye_(and_OK) output 5 4 括号外面的连续的字符串最长的字符串长度为 5 括号内有 4 个连续…
题目链接: http://codeforces.com/problemset/problem/546/C 题意: 总共有n张牌,1手中有k1张分别为:x1, x2, x3, ..xk1,2手中有k2张,分别为:y1, y2, ...yk2:(n<=10&&k1+k2==n,所有牌的数字都不同): 依次比较x1, y1的大小,若x1>y1,依次将x1, y1加入x牌最底下:反之则将y1,x1依次加入y牌最底下:直至有方的牌输完为止:输出总共游戏的步数和赢方: 如果两方都不能赢,则…
http://codeforces.com/problemset/problem/749/C 题意:有n个人投票,分为 D 和 R 两派,从1~n的顺序投票,轮到某人投票的时候,他可以将对方的一个人KO,被KO的人不能投票了,这样循环,直到某一派的人全部被KO,问哪方赢. 思路:模拟..代码好懂.. #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #i…
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/problem/A Description You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon…
B. Complete the Word time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segmen…
题目链接:http://codeforces.com/problemset/problem/797/C 题意: 给你一个非空字符串s,空字符串t和u.有两种操作:(1)把s的首字符取出并添加到t的末尾.(2)把t的尾字符取出并添加到u的末尾. 问你当经过一系列操作后,s和t均为空时,字典序最小的u. 题解: 操作的本质: s为队列,t为栈. 贪心思路: (1)找到s中的最小字符c,不断出队并加入t,直至有一次出队的字符等于c,停止出队. (2)当t的尾字符小于等于s中的最小字符时,优先弹出t的尾…
C. Bear and Different Names time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communicati…
1.cd命令 cd:及Change Directory改变目录的意思,用于更改到指定的目录 用法:cd [目录] 其中 "."代表当前目录,".."代表当前目录的父级目录,"-"代表上一次使用的目录,"~"当前用户的主目录 如: cd .. 进入父级目录 cd - 进入上一次所在的目录(改变后之前的目录) cd ~ 进入当前用户的主目录 [root@mini ~]# cd .. [root@mini /]# pwd / [ro…
C. Tic-tac-toe 题目连接: http://www.codeforces.com/contest/3/problem/C Description Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3 × 3 grid (one player always draws…
B. Spreadsheets 题目连接: http://www.codeforces.com/contest/1/problem/B Description In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second - number B, etc. till c…
Ballot Analyzing Device 题目连接: http://codeforces.com/gym/100269/attachments Description Election committee of Flatland is preparing for presidential elections. To minimize human factor in ballot counting they decided to develop an automated Ballot Ana…
地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider 2n rows of the seats in a bus. n rows of the seats on the left…
题目链接:http://codeforces.com/problemset/problem/702/D 题意: 一个人要去邮局取东西,从家到达邮局的距离为 d, 它可以选择步行或者开车,车每走 k 公里就要花费 t秒修一次才可以继续开,车每公里花费 a秒,步行每公里花费 b秒.依次给出d, k, a, b, t.问最少需要花费多少时间到达邮局.车刚开始时是好的. 思路: 首先可以模拟一下,可以想到,如果车速比步速块,那么前 k公里路肯定选择坐车,因为开始时车是好的,不用花费多余的时间来修理车,否…
A. Fox and Box Accumulation time limit per test:1 second memory limit per test:256 megabytes Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its t…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp loves ciphers. He has invented his own cipher called Right-Left. Right-Left cipher is used for strings. To encrypt the string s=s1s2…
1.向上向下翻页: 反向的命令一般是Shift-PageUp和Shift-PageDown. 每日一命令:cd 1.cd /   进入系统根目录 2.cd ..   进入系统根目录可以使用“ cd .. ”一直退,就可以到达根目录 3.“当前用户主目录”和“系统根目录”是两个不同的概念.进入“当前用户主目录“有两个方法.1.cd :2.cd ~ 4.cd - 返回进入此目录之前所在的目录 每日一命令:pwd 1.pwd  查看”当前工作目录“的完整路径 2.目录连接链接时,pwd -P  显示出…
C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem, your task is to use ASCII graphics to paint a cardiogram. A cardiogram is a polyline with the following corner…
1 命令提示符 1.1 [ root @ oldboyedu62  ~  ] 1 2 3     4 1:登陆系统的用户身份 2:命令分割符合 3:主机名称信息 4:显示当前所在目录路径 1.2 系统操作命令格式 1.命令+空格+参数信息 例如:mk -p 命令:mk 参数信息:-p 2.命令+空格+参数信息+空格+处理的对象信息(目录,文件) 例如:ls -d oldboy 命令:ls 参数信息:-d 处理的对象信息:oldboy 2 系统的目录结构(tree) yum安装没有的东西 yum…
http://codeforces.com/contest/705/problem/C 题目 模拟题 : 设的方法采用一个 r 数组(第几个app已经阅读过的消息的数量),和app数组(第几个app发出的消息的总数),加上一个 q 队列. 思路: 查询==1的时候,入队(记录顺序), sum++ (sum 为全部的剩余 没阅读的数量) 查询==2的时候,针对一个app,sum -(这个app发出的消息的总数 - 这个app已经阅读过的消息的数量),然后用 app数组 更新 r 数组,表示这个ap…
You are given a function ff written in some basic language. The function accepts an integer value, which is immediately written into some variable xx. xx is an integer variable and can be assigned values from 00 to 232−1232−1. The function contains t…