摘要:
#include main(){ FILE *fp; if((fp=fopen("in.txt","rt"))==NULL) { printf("错误:文件不存在"); getch(); exit(1); } while(fsc... 阅读全文
摘要:
第四届河南省大学生程序设计竞赛 第一题题目描述Dr.Kong设计了一个聪明的机器人卡多,卡多会对电子表格中的单元格坐标快速计算出来。单元格的行坐标是由数字编号的数字序号,而列坐标使用字母序号。观察字母序号,发现第1列到第26列的字母序号分别为A,B,…,Z,接着,第27列序号为AA,第28列为AB,... 阅读全文
摘要:
声明一个char类型的栈。假设题目输入内容为n(int),a(string),b(string),a、b的下标记为index1和indexe2。第一步肯定是入栈。然后遍历b中每个字符: 如果栈不为空且栈顶元素等于b[index2],出栈。否则a[index1]入栈,如果没有元素可入栈,输出No。... 阅读全文
摘要:
This problem is just like java's BigInteger:#include #include using namespace std;string format(string str){ bool zheng=true; int ppos=str.find('.'); ... 阅读全文
摘要:
以下部分内容并非原创,原作者见到还请谅解~大数String s=”12345”;BigInteger c=BigInteger.valueOf(s);格式输出System.out.printf("%+8.3f\n", 3.14); //"+"表示后面输出的数字会有正负号,正的+,负的- ;8.3f表... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 int t,len,k,num,sum; 9 int a[27];10 bool vis[27];11 string st... 阅读全文
摘要:
利用Prim算法求最小生成树,其工作原理与Dijkstra相似。这棵树从一个任意的根节点r开始,一只长大到覆盖V中的所有顶点为止。算法每一步加入的边都必须是使树的总权重增加量最小的边。代码转载自:http://www.cnblogs.com/Veegin/archive/2011/04/29/203... 阅读全文
摘要:
No.1: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 #include13 #include14... 阅读全文
摘要:
Water ~ 1 #include 2 #include 3 #include 4 5 using namespace std; 6 const int INF=100000000; 7 8 int t,n,a; 9 int main()10 {11 cin>>t;12 ... 阅读全文
摘要:
已知:1,2元的硬币共n枚,能表示的钱数为[n,2n]。所以,每次去掉5元,如果剩下的钱能用1,2元表示,结果就+1。#include #include using namespace std;const int MAXN=1000000;int main(){ int t,n,m; s... 阅读全文