集训 T1-找试场】的更多相关文章

拖延症又犯了QwQ. 今天上午考试了,按照惯例,我仍然要把我会的所有题的题解写一遍. 1.找试场(way.cpp/in/out) 问题描述 小王同学在坐标系的(0,0)处,但是他找不到考试的试场,于是一边走路一边问路, 每个被问路的人会告诉他一个指令(包括走路或转弯),现在请编一个程序,显示他每次走 路后的坐标(转弯后坐标不变,所以不必显示坐标). 初始方向向 y 轴正半轴!! 输入格式 第一行一个数 n,表示有 n 个指令,接下来 n 行每行一个指令,每个指令是“left” 或 “right”…
[题解] 先建反向图,然后跑拓扑排序求出最长路. 将所有的点按照最长路从小到大分层,把上一层连向这一层的边按照边权为第一关键字.起点的排名为第二关键字排序. 按照这个顺序更新这一层的答案,按照这一层每个点被更新的顺序得到这一层的点的排名. #include<cstdio> #include<cstring> #include<algorithm> #define LL long long #define rg register #define N 1000010 #de…
大致题意: 按照给定的指令移动,输出最后到达的点. 若没有走动过则输出(0,0). 基本思路 这题就是模拟,主要是判断指令的时候不太好判断, 先用字符串把指令读取进来,看看第一位是否是数字(如果是数字那么就证明整个指令都是数字), 如果不是数字那么这个指令就是"left"或"right"了, 然后按照指令去走就可以咯. Code: #include <iostream> #include <cstdio> #include <cstri…
Description In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1to 109. A toy from the new collection of the i-th type costs i bourles. Tania has managed to collect n …
凉 (比赛链接)[https://www.nowcoder.com/acm/contest/177#question] T1 (题目链接)[https://www.nowcoder.com/acm/contest/177/A] 首先考虑二维前缀和 [l1, r1], [l2, r2]的解 即ans([0, r1], [0, r2]) - ans([0, l1 - 1], [0, r2]) - ans([0, l2 - 1], [0, r1]) + ans([0, l1 - 1], [0, l2…
Description       You must have heard that the Chinese culture is quite different from that of Europe or Russia. So some Chinese habits seem quite unusual or even weird to us.       So it is known that there is one popular game of Chinese girls. N gi…
Description Berland has n cities connected by m bidirectional roads. No road connects a city to itself, and each pair of cities is connected by no more than one road. It is not guaranteed that you can get from any city to any other one, using only th…
Description Maria participates in a bicycle race. The speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, east or west. Let's in…
非常简单的单点修改+区间加+区间查询.我用的是最近刚学的区间修改版本树状数组.  直接维护即可,注意修改后的单点值已经不是a[i],或者b[i],要通过区间查询求单点.不然是错的. 区间修改版本树状数组: #include<iostream> #include<string.h> #include<stdio.h> #include<algorithm> #define LL long long using namespace std; LL c_p[];…
2016.10.7初中部上午NOIP普及组比赛总结 这次的题还可以,重新入了比赛的前十. 进度: 比赛:90+10+70+30=200 改题:AC+AC+AC+AC=AK 找试场 这题很简单,但是被欺负了十分. 题目简化: 一个人在(0,0),然后盲目听信别人的意见, 顺着某些方向走啊走啊. 问最后的坐标. 比赛思路: 方向数组就不用说了吧-- 有一个东西专门标记方向. 用字符串读入,如果是字母,则标记方向的要变. 如果是数字,则改变坐标,输出. 然后就没什么了. (其实这题的难点没有什么,我只…