蛇形填数: 在n×n方阵里填入1,2,....,n×n,要求填成蛇形.例如,n = 4 时方阵为:    10  11  12  1   9  16  13  2 8  15  14  3 7   6    5   4 上面的方阵中,多余的空格只是为了便于观察规律,不必严格输出.n <= 8 . 类比上面这种数学中的矩阵,我们可以考虑使用一个二维数组来储存. 解题思路:从右上角开始往下填数,当到底的时候转向左填值,当到左边的边的时候转向上填数,当到最上面的时候转向右填值...依次类推.第一轮转…
题意:模拟客服MM,一共有N种话题,每个客服MM支持处理其中的i个(i < N),处理的话题还有优先级.为了简化流程方便出题,设每个话题都是每隔m分钟来咨询一次.现知道每个话题前来咨询的时间.间隔.处理此话题所需的时长与一共有多少次咨询.问多少时间后全部话题处理完成. 代码:(Accepted,0.010s) //UVa822 - Queue and A //Accepted 0.010s //#define _XIENAOBAN_ #include<algorithm> #includ…
题意:不难理解,照搬题意的解法. 代码:(Accepted,0.190s) //UVa1597 - Searching the Web //#define _XIENAOBAN_ #include<iostream> #include<sstream> #include<cstring> #include<string> #include<vector> #include<map> #include<set> using…
题意:一堆文件但只有一个打印机,按优先级与排队顺序进行打印.也就是在一个可以插队的的队列里,问你何时可以打印到.至于这个插队啊,题目说"Of course, those annoying term papers that others are printing may have to wait for quite some time to get printed, but that's life."嗯,这就是生活. 代码:(Accepted, 0ms) //UVa12100 - Pri…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa1593 - Alignment of Code #include<iostream> #include<algorithm> #include<vector> #include<string> #include<sstream> #include<iterator> #include<iomanip…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa815 - Flooded! #include<iostream> #include<algorithm> int M, N, W, S[1000], T = 0; int main() { //freopen("in.txt", "r", stdin); while (scanf("%d%d"…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa12108 - Extraordinarily Tired Students #include<iostream> struct how_cute_my_sleepy_boys_are { int a,//awaken period : a>=1; b,//sleeping period : b<=5; s,//state : 0醒着,1睡觉; t;//…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa509 - RAID! #include<iostream> int d, s, b, t, times = 0; char disk_data[7][6666], type; inline char* disk(int x, int y, int z) {//二维数组当作三维数组使,方便运算 return *(disk_data + x - 1) + (y - 1…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,10 ms) //UVa508 - Morse Mismatches #include<iostream> #include<string> #include<map> using namespace std; map<char, string> morse; map<string, string> word; string wo, tra…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa1590 - IP Networks #include<iostream> unsigned i, m, num, ip[4], ipmax[4], ipmin[4], mask[4]; int cmp(unsigned *a, unsigned *b) {//compare for (int i = 0;i < 4;++i) { if (a[i] <…