学习数据结构的第十四天www - 人们常用的电子表格软件(比如: Excel)采用如下所述的坐标系统:
学习了这么久了,每次看同学的博客都深深的自卑www,感觉我是不是有点太较真了。我也感觉是时候学习一门新的语言了,不然我就会很被动。
# Spreadsheets
## 题面翻译
人们常用的电子表格软件(比如: Excel)采用如下所述的坐标系统:
第一列被标为 A,第二列为 B,以此类推,第 $26$ 列为 Z。接下来为由两个字母构成的列号: 第 $27$ 列为 AA,第 $28$ 列为 AB $\cdots$ 在标为 ZZ 的列之后则由三个字母构成列号,如此类推。
行号为从 $1$ 开始的整数。
单元格的坐标由列号和行号连接而成。比如,BC23 表示位于第 $55$ 列 $23$ 行的单元格。
有时也会采用被称为 RXCY 的坐标系统,其中 $X$ 与 $Y$ 为整数,坐标 $(X$,$Y)$ 直接描述了对应单元格的位置。比如,R23C55 即为前面所述的单元格。
您的任务是编写一个程序,将所给的单元格坐标转换为另一种坐标系统下面的形式。
## 输入
第一行一个整数 $n$ $(1$ $\le$ $n$ $\le$ $10^5)$ 表示将会输入的坐标的数量。
接下来 $n$ 行,每行一个坐标。
注意: 每个坐标都是正确的。此外不会出现行号或列号大于 $10^6$ 的单元格。
输出 $n$ 行,每行一个被转换的坐标。
## 输出 $n$ 行,每行一个被转换的坐标。
## 题目描述
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 column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow three-letter numbers, etc.
The rows are marked by integer numbers starting with 1. The cell name is the concatenation of the column and the row numbers. For example, BC23 is the name for the cell that is in column 55, row 23.
Sometimes another numeration system is used: RXCY, where X and Y are integer numbers, showing the column and the row numbers respectfully. For instance, R23C55 is the cell from the previous example.
Your task is to write a program that reads the given sequence of cell coordinates and produce each item written according to the rules of another numeration system.
## 输入格式
The first line of the input contains integer number $ n $ ( $ 1<=n<=10^{5} $ ), the number of coordinates in the test. Then there follow $ n $ lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than $ 10^{6} $ .
## 输出格式
Write $ n $ lines, each line should contain a cell coordinates in the other numeration system.
## 样例 #1
### 样例输入 #1
``` 2 R23C55 BC23 ```
### 样例输出 #1
``` BC23 R23C55 ```
这次别说了,原汁原味的复制链接。
来看题目,要求的是什么,首先就是一个表嘛,时间表。那么意思是什么呢?
虽然画的有点抽象,但是理解还是很容易的。怎么判断他够不够时长呢?很简单,总时长>总最小时长&&总时长<最大时长;这就只需要求和就行了。那么怎么输出符合的每天的时间呢?首先,YES的条件是不是满足大于最小值,那么总的时长减去总的最小值是不是就是可以分配在区间的总时长?那么,我们只需要从最小的T1开始分配其最大值,如果不够最大值就直接输入剩下可分配的时长是不是就行了?也就是上图T1分配1+0;T2分配1+(5-1)-1;这是不是很好懂了。那么上代码。
#include
int timeminax[100][2];
int main() 拼多多帮助力入口
{
int i,d,sumt,sumin=0,sumax=0;
scanf("%d%d",&d,&sumt);
for(i=0;i
{
scanf("%d%d",&timeminax[i][0],&timeminax[i][1]);
sumin+=timeminax[i][0];//总的最小值
sumax+=timeminax[i][1];//总的最大值
}
if(sumt>=sumin&&sumt<=sumax)//判断有没有解
{
i=0;
sumt=sumt-sumin;//算出总的可分配的时长
while(sumt)
{
if(sumt>timeminax[i][1]-timeminax[i][0])//逐一分配满
{
sumt=sumt-timeminax[i][1]+timeminax[i][0];
timeminax[i][0]=timeminax[i][1];//用数组一作输出体
}
else//不满就是其本身
{
timeminax[i][0]+=sumt;
sumt=0;//终止循环的条件
}
i++;
}
printf("YES\n");
for(int j=0;j
{
printf("%d ",timeminax[j][0]);
}
}
else
{
printf("NO");
}
return 0;
}
总有人说我写的不详细,这保姆级别的够详细了吧。
好文链接