
sicily
晨识草
同样都是碳
展开
-
1741.Jaunt around the Zhuhai Campus
Input:The first line of the input is a positive integer T.T is the number of the test cases followed. The first line of each test cases contains only one positive integer N(1Output:The output of the p原创 2016-07-05 20:10:58 · 226 阅读 · 0 评论 -
1510. Mispelling
题意:将字符串在指定位置的字符去掉后输出即可InputThe first line of input contains a single integer N , (1≤N≤1000) which is the number of datasets that follow.Each dataset consists of a single line of input containing M , a原创 2016-07-06 07:02:51 · 366 阅读 · 0 评论 -
1561. PRIME
题意:寻找第几个素数Sample Input30Sample Output113代码实现:// 寻找第n个素数#include<iostream>#include<cmath>using namespace std;bool isPrime(int num) { int temp = floor(sqrt(double(num)) + 0.5); for (int i = 2; i原创 2016-07-06 07:05:09 · 254 阅读 · 0 评论 -
3497. 水仙花数
若三位数ABC满足ABC=A3+B3+C3,则称ABC为水仙花数. 例如153就是一个水仙花数. 编程找出100~999范围内的所有水仙花数.代码实现:// 水仙花数#include<iostream>#include<cmath>using namespace std;int main() { int a, b, c; int result = 0; int num; int原创 2016-07-06 07:08:07 · 520 阅读 · 0 评论 -
1036.crypto columns
离散数学讲过这种加密的方法,其实就是字典序一. 排序方法说明先通过keyword,例如如果是BATBOY的话, 按照字母表的先后顺序应该是104235, 也就是比如字符串是EYDEMBLRTHANMEKTETOEEOTH的话,首先因为keyword长度为6,所以排序的时候矩阵就是6列,行数是字符串的总数除以keyword的长度,此例中就是4*6矩阵. 首先对于给出的字符串先从第2列开始排,从下网上原创 2016-05-22 18:59:49 · 810 阅读 · 0 评论 -
1747. 内存使用
1.注意operator<应该声明为const函数// 例如输入是 14 2的时候表示的是总的内存是14 , 总共有2个进程 // 接下来有2行, 每行分别是进程进行计算需要的内存和存放计算结果需要的内存// 需要判断的是,总的内存减去上一个进程存放结果的内存以后大于或等于下一个进程计算需要的内存// 另外是进程需要先进行排序,计算需要内存最多的最先进行,如果计算需要的内存相同,则存放结果需要原创 2016-07-06 15:33:24 · 500 阅读 · 0 评论 -
1097. LED Modding
Sample Input 5 3 20 2 Red 90 Orange 110 5 3 20 2 ThisOne 110 TheOtherOne 100 5 3 20 1 TooLittle 90 5 5 20 1 Sample 10Sample Output 100.00 Orange 100.00 TheOtherOne原创 2016-07-06 16:04:38 · 264 阅读 · 0 评论 -
1286. Pascal Library
题意:第一行输入的是n , d,n代表总共有n个校友, d代表的是总共举办了d次晚会 接下来是d*n的矩阵,记录了每个校友在这d次晚会的参与情况 求是否有校友参加了全部的晚会(只需要求是否有某一列全部为1即可) 输入为0 0的时候结束Sample Input3 3 1 1 1 0 1 1 1 1 1 7 2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0Sa原创 2016-07-08 09:38:48 · 393 阅读 · 0 评论 -
1122. Prerequisites?
题意:第一行输入n, m;分别表示的是该同学总共选了n门课程和改同学需要修的m种课程 接下来是m行,每一行首先由两个数字假设为a, b; a 表示的是这个种类的课程总共有a门,b表示该同学至少需要修读b们改类课程 如果该同学有哪一类课程不满足要求则不能够毕业,输出”no”,否则输出”yes”Sample Input3 2 0123 9876 2222 2 1 8888 2222 3 2原创 2016-07-08 10:15:04 · 297 阅读 · 0 评论 -
1199.GCD
题意:输入n,m 求满足1 <= x <= n; 而且(x , n)(即x和n的最大公约数)>= m的所有x的总数代码:过了测试样例,但是超时了#include<iostream>#include<cmath>using namespace std;int mygcd(int n, int m) { int max = 1; for (int i = 1; i <= m; ++原创 2016-07-08 11:20:25 · 307 阅读 · 0 评论 -
1093 Air Express
1093 Air Express[1]Input:The input file will have one or more data sets. Each data set begins with exactly 4 lines, giving the shipping rates. These will be: weight1 rate1 weight2 rate2 weight3 rate原创 2016-12-06 20:53:30 · 377 阅读 · 0 评论 -
1156 Binary Tree
Binary Tree题目DescriptionYour task is very simple: Given a binary tree, every node of which contains one upper case character (‘A’ to ‘Z’); you just need to print all characters of this tree in pre-orde原创 2016-12-06 21:20:02 · 437 阅读 · 0 评论 -
1154 easy Sort
很简单的排序// 简单的排序#include <iostream>#include <stdio.h>#include <stdlib.h>using namespace std;int main() { int arr[1001]; int t, temp; int n; cin >> t; while (t--) { cin >> n; for (i原创 2016-12-06 21:42:44 · 311 阅读 · 0 评论 -
编译原理词法分析
1.题目描述 2.代码实现(1)注意标识符和无符号整数的重复问题,本人采用map解决。 (2)cin >> ch自动忽略空白字符。#include <iostream>#include <vector>#include <string>#include <map>using namespace std;struct pairs { int category; int ra原创 2017-10-16 16:38:17 · 427 阅读 · 0 评论 -
1000-输入输出LL(1)语法分析程序
注:编译原理题目题目描述 代码实现#include <iostream>#include <vector>#include <cstring>#include <string.h>#include <iomanip>using namespace std;#define MAXSIZE 1000string result[MAXSIZE][MAXSIZE];string e原创 2017-12-07 13:17:57 · 547 阅读 · 0 评论 -
1443. Printer Queue
注:c++实验课堂题目InputOne line with a positive integer: the number of test cases (at most 100). Then for each test case:One line with two integers n and m, where n is the number of jobs in the queue (1 ≤ n原创 2016-07-05 20:59:34 · 250 阅读 · 0 评论 -
1200. Stick
题目:将不能够配对的筷子输出InputThe input file will consist of several cases. Each case will be presented by an integer n (1<=n<=100, and n is odd) at first. Following that, n positive integers will be given, one原创 2016-07-05 20:56:05 · 581 阅读 · 0 评论 -
1157. The hardest problem
简单的大小比较问题// 简单的大小比较// 注意题目中的signed 32-bit integers,所以maxnum不能初始化为0.#include<iostream>using namespace std;int main() { int n; int temp; int result; while (cin >> n && n != 0) { cin >>原创 2016-07-05 20:52:54 · 281 阅读 · 0 评论 -
1692.cover
代码实现:#include<iostream>using namespace std;int main() { int n, m; while (cin >> n >> m && !(n == 0 && m == 0)) { if ((n * m) % 8 == 0 && n != 1 && m != 1) cout << "YES" << endl;原创 2016-07-05 20:05:07 · 254 阅读 · 0 评论 -
1691.Abundance
Abundance题意:An abundant number is a positive integer n for which Sigma(n) – 2n > 0, Where Sigma(n) is defined as the sum of all the divisors of n. And the quantity Sigma(n) – 2n is called abundance. G原创 2016-07-05 20:02:33 · 305 阅读 · 0 评论 -
3980.二进制转十进制
问题:将二进制数转换为十进制Sample Input:3 100 001 10100Sample Output4 1 20代码实现:// 将二进制转换为十进制#include<iostream>#include<cstring>#include<cmath>using namespace std;int main() { int t, len, sum; stri原创 2016-07-05 20:15:33 · 303 阅读 · 0 评论 -
1002.Anti-prime Sequences
Input:Input will consist of multiple input sets. Each set will consist of three integers, n, m, and d on a single line. The values of n, m and d will satisfy 1 <= n < m <= 1000, and 2 <= d <= 10. The l原创 2016-07-05 20:21:06 · 366 阅读 · 0 评论 -
1218.纪念邮票
Description邮局最近推出了一套特殊的纪念邮票,这套邮票共有N张,邮票面值各不相同,按编号顺序为1分,2分,......,N分。小杭是个集邮爱好者,他很喜欢这套邮票,可惜现在他身上只有M分,并不够把全套都买下。他希望尽量买,最好刚好花光所有钱。作为一个集邮爱好者,小杭也不想买的邮票编号断断续续。所以小杭打算买面值a分至b分的b-a+1张连续的邮票,且总价值刚好为M分。你的任务是求出所有符合要原创 2016-07-05 20:24:11 · 775 阅读 · 0 评论 -
1815. 计算两点间的距离
Sample Input2 0 0 0 1 0 1 1 0Sample Output1.00 1.41代码实现:// 求两点之间的距离,注意输出的格式即可#include<iostream>#include<cmath>#include<stdio.h>using namespace std;int main() { double x1, x2, y1, y2, a, b,原创 2016-07-05 20:26:45 · 361 阅读 · 0 评论 -
1746. DreamingAboutCarrots
InputThe input contains several test cases. Each test case contains four integers, x1,y1,x2,y2, all integers will between 0 and 50, inclusive.. The input will be terminated by EOF.OutputFor each test原创 2016-07-05 20:31:07 · 196 阅读 · 0 评论 -
1000.A-B
简单题目#include<iostream>using namespace std;int main() { int a = 0, b = 0; int result; cin >> a >> b; result = a - b; cout << result << endl; return 0;}原创 2016-07-05 20:32:34 · 215 阅读 · 0 评论 -
1001. Alphacode
InputInput will consist of multiple input sets. Each set will consist of a single line of digits representing a valid encryption (for example, no line will begin with a 0). There will be no spaces betw原创 2016-07-05 20:34:22 · 374 阅读 · 0 评论 -
1006. Team Rankings
InputThere will be multiple input sets. Input for each set is a positive integer n on a line by itself, followed by n lines (n no more than 100), each containing a permutation of the letters A, B, C, D原创 2016-07-05 20:38:14 · 380 阅读 · 0 评论 -
1007. To and Fro
InputThere will be multiple input sets. Input for each set will consist of two lines. The first line will contain an integer in the range 2 . ..20 indicating the number of columns used. The next line i原创 2016-07-05 20:41:21 · 238 阅读 · 0 评论 -
1014. Specialized Four-Dig
题意:For example, the number 2991 has the sum of (decimal) digits 2+9+9+1 = 21. Since 2991 = 1*1728 + 8*144 + 9*12 + 3, its duodecimal representation is 189312, and these digits also sum up to 21. But原创 2016-07-05 20:44:10 · 282 阅读 · 0 评论 -
1021. Couples
用栈实现#include<stdio.h>#include<stdlib.h>int main() { int coupleNumber[300000]; int stack[300000]; int n, i, a, b, top; n = 1; while (scanf("%d", &n) == 1&&n) { for (i = 0; i原创 2016-07-05 20:45:40 · 228 阅读 · 0 评论 -
1087. A Funny Game
// 这个游戏的规则是每次只能够取一个或者是两个相邻的硬币// 取掉最后一个硬币的获胜// 当硬币的总数为1或者是2的时候,第一个取的人赢// 当硬币的总数大于2的时候// 若硬币的总数为偶数,则Bob只要取与Alice相同的硬币数目就总能够获胜// 若硬币的总数为奇数,则Bob在第一次的时候取与Alice不同的数目的硬币,从而转换为偶数的问题了// 所以不管怎样,Bob总是能够获胜#原创 2016-07-05 20:47:34 · 291 阅读 · 0 评论 -
1119. Factstone Benchmark
DescriptionAmtel has announced that it will release a 128-bit computer chip by 2010, a 256-bit computer by 2020, and so on, continuing its strategy of doubling the word-size every ten years. (Amtel rel原创 2016-07-05 20:50:57 · 371 阅读 · 0 评论 -
输入输出LL(1)语法分析程序
注:编译原理题目描述 代码实现对照分析表实现 // sicily 2, complier course#include <iostream>#include <vector>#include <cstring>#include <string.h>#include <iomanip>#include <stack>using namespace std;#define原创 2017-12-07 19:42:42 · 4015 阅读 · 0 评论