### 求助一道c语言编程题 [问题点数：30分，结帖人dsb89323532]

Wii游戏机有两个手柄，每个手柄使用两节电池（这两个电池可以是不同的品牌），其中至少一块电池没电时该手柄没电。rnrn工程师们在玩游戏时，总是用最简单的方式更换电池：有手柄没电时把所有没电的电池拿走，一一换上新电池即可（有电的电池总是继续使用）。当有手柄没电但没有新电池可用时才停止玩Wii。rnrn告诉你每个品牌电池的使用时间以及该品牌电池的个数，请计算工程师们玩游戏时间的最小值和最大值。rnrnrn输入格式rn输入第一行为一个正整数n，表示电池的种数。接下来n行，每行两个整数L和F，表示使用时间为L的电池有F个（电池不必成对出现，即F可以是奇数）。 rnrn输出格式rn输出仅一行，包含两个整数，分别表示工程师们的最短游戏时间和最长游戏时间（短的时间在前）。两个整数之间以空格隔开。 rnrn输入样例 例rn3rn3 2rn5 2rn8 2rnrnrn输出样例 例rn5 8rnrnrn

#include rnvoid main()rnrnint m,n;rnfor(m=n=1;m=10)break;rn if(n%3==1)n+=3;continue;rnrn printf("%d\n",m);rnrnrn为什么运行结果为：4rnrn

DescriptionrnAn adjacent difference of a sequence is a new sequence formed by replacing every element with the difference between the element and rnthe immediately preceding element. The first value in the new sequence remains unchanged. For example, a sequence such as (1, 3, 2, 4, 5) rnis transformed into (1, 3-1,2-3, 4-2, 5-4), and in this manner becomes the sequence (1, 2, -1, 2, 1). Then, we want to sort the adjacent rndifference of the sequence in non-decreasing order. It?s an easy job for you, isn?t it? So, please solve it quickly.rnInputrn Standard input will contain multiple test cases. The first line of the input is a single integer T(1 < sum; i++)rn scanf("%d", &a[i]);rn for (i = sum - 1; i > 0; i--)rn a[i] -= a[i - 1];rnrn for (i = 1; i < sum; i++)rn rn for (j = i; j > 0 && a[j] < a[j - 1]; j--)rn rn tmp = a[j];rn a[j] = a[j - 1];rn a[j - 1] = tmp;rn rn rn printf("Case %d:\n", k);rn for (i = 0; i < sum; i++)rn rn printf("%d", a[i]);rn if (i != sum - 1)rn printf(" ");rn rn if (k != n)rn printf("\n\n");rn rnrn return 0;rn[/code]

[求助]一道汇编题
rnrn在屏幕的 8行3列，用绿色显示data段中的字符串rnrnassume cs:codernrndata segmentrnrn db 'Welcome to masm!',0rnrndata endsrnrncode segmentrnrnstart: mov dh,8rnrn movdl,3rnrn mov cl,2rnrn mov ax,datarnrn mov ds,axrnrn mov si,0rnrn call show_strrnrn mov ax,4c00hrnrn int 21hrnrnshow_str: ：rnrn ：rnrn ：rnrncode endsrnrnend startrnrn(dh)= 行号 (dl)=列号 (cl)=颜色rn rn

int a; rnrnfun(int i) rnrn a+=2*i; rnrnreturn a; rnrnmain() rnrnint a=10; rnrnprintf("%d,%d\n",fun(a),a); rnrn rnrn

POJ1011:http://acm.pku.edu.cn/JudgeOnline/problem?id=1011&lang=zh-CNrnDescriptionrnrn乔治拿来一组等长的木棒，将它们随机地砍断，使得每一节木棍的长度都不超过50个长度单位。然后他又想把这些木棍恢复到为裁截前的状态，但忘记了初始时有多少木棒以及木棒的初始长度。请你设计一个程序，帮助乔治计算木棒的可能最小长度。每一节木棍的长度都用大于零的整数表示。rnInputrnrn输入包含多组数据，每组数据包括两行。第一行是一个不超过64的整数，表示砍断之后共有多少节木棍。第二行是截断以后，所得到的各节木棍的长度。在最后一组数据之后，是一个零。rnOutputrnrn为每组数据，分别输出原始木棒的可能最小长度，每组数据占一行。 rnSample Inputrnrn9rn5 2 1 5 2 1 5 2 1rn4rn1 2 3 4rn0rnrnSample Outputrnrn6rn5rn上次看了飞雪大牛的代码不太懂,又自已写了个,讨论区的所有数据都能过,除了那种特别BT的,连AC的程序都过不了的,可提交的时候还是RE,实在没法了,大家帮我看看rn[code=C/C++]#includern#includern#includern#includernusing namespace std;rnbool search(int length,int p);rnbool find(int l);rnint wood[100],sol[200];//记录木棒信息，已用的木棒信息rnbool use[100];//记录使用情况rnint sum,key,n;//砍断后的木棒长度和，当前正在用的木棒，木棒总数rnint main()rnrn int i,total;rn while (scanf("%d", &n) == 1, n)rn rn memset(wood,0,sizeof(wood));rn memset(sol,0,sizeof(sol));rn memset(use,false,sizeof(use));rn total=n;rn sum=0;rn for(i=0;i());//剪枝:将木棒长度从大到小排rn if(sum%wood[0]==0&&find(wood[0]))rn rn printf("%d\n",wood[0]);rn rn elsern total/=2;//剪枝:因最长的木棒不合要求,故每根木棍至少由两根木棒合成rn dorn while(sum/totalsum/l||keylength||use[i]||i==n)//找到比剩余长度小且未被使用过的木棒rn rn if(i==n)rn rn key--;rn length+=wood[sol[key]];rn use[sol[key]]=false; rn i=sol[key];rn sol[key]=0;rn while(wood[i]==wood[i+1])i++;rn //剪枝:因该长度不合要求,故找下一根不同长度的木棒(很重要)rn if(sol[key-1]==-1)sol[--key]=0;return false;rn rn i++;rn rn length-=wood[i];rn use[i]=true;rn sol[key++]=i;rn i++;rn rnrn return true;rn[/code]

[img=http://image161.poco.cn/mypoco/myphoto/20100516/15/55200369201005161537244563047659846_000_640.jpg][/img]

class basernrnpublic: rn base() p=this;rn ~base()rn rn if(p!=NULL)rn rn delete p;p=NULL;rn rn rn A *p;rn;rnrn这段代码有什么问题啊？

1、有数据库Book，其中有表Books 图书表：rnrn字段名 字段类型 允许NULL 默认值 字段意义 注释rnBookId Int NOT NULL 图书编号 主键（自动增长）rnBookName Nvarchar(50) NOT NULL 图书名称 rnAuthor Nvarchar(50) 作者 rnPrice Decimal（18,2） 价格 rnBuildDate DateTime 创建时间 rnrn基于此表，请使用.NET分层开发方法完成新增图书程序。rnrn1） 以在web.config中建立连接字符串BookDSN，请写出Model层中的Book类和BLL层中BookBLL的AddBook方法。（8分）rnrn2）已有book_add.aspx页面前台代码如下，请写出后台代码，实现新增图书功能。（6分）rnBook_add.aspx:rn rn rn 图书名称:rn rn rn rn 作者:rn rn rn rn 价格:rn rn rn rn 创建时间:rn rn rn rn rn rn rn rnrn请写出book_add.aspx.cs的代码：rn

#includernrn#includernrnclass Stringsrnrnrn char * ps;rnrn friend ostream& operator<<<

Problem statementrnrnYou must work out a class to handle a simple database that is persistently stored in a single text file. The lines of the text file contain the following 'fields' : name, e-mail address, telephone number(s), and attendance to class. A sample file is made available in computer readable format for testing purposes.rnrnThe class must have member functions forrnrn• displaying the contents of the databasern• retrieving the total percentage of attention out of 19 meetingsrn• retrieving this percentage for a student by the name of the studentrn• modifying the e-mail address by name of studentrn• adding a new studentrnrnModified values must be recorded in the file.rnrnYou may optionally work out member functions torn rn• display the database ordered by name rn• remove a studentrn• retrieving the entries one by one in the client (test driver)rnrnrntest file:rnrnInesa vestbam@hotmail.com 40950908 16rnYasir Yasir142@hotmail.com 22401557 15rnAdey Adey@sol.dk 28154118/32966667 8rnBi bxbell@hotmail.com 26747237 9rnBoHu DuBoHu@hotmail.com 28925895 7rnChen HaveyChen@hotmail.com 60618956 18rnDavis Dnpro@hotmail.com 36380416 7rnEsteban tebiches@hotmail.com 32876087 18rnDevine Ebeny99@yahoo.com 26702599 16rnSylvie esovy@yahoo.co.uk 22502441 19rnPablo Pablofog@hotmail.com 40924546/46974549 15rnVara Vara_prasad81@rediffmail.com - 14rnRonny molinn@strik.is 23679516 19rnFannar fannar@mi.is 29249885 17rnJurgita jurgitakopytina@yahoo.com 20858105 19rnIbrahim Walibru@hotmail.com 22528988 18rnKristina Kristina@surfmail.dk 27291599 19rnLoay Loay@12mail.dk 44974800-132/25710759 17rnMariam mariammir17@hotmail.com 22899845 19rnRegina Reginka@centras.lt 26367456 15rnMaral Marhei2@niels.brock.dk 48160792 15rnLudi Ludmem@hotmail.com 26220974 14rnErnest ernjum@niels.brock.dk 32582717 11rnSheng Shengqian2008@yahoo.com.cn - 10rnPavan pavangadiraju@hotmail.com - 7rnYou youchenxi@hotmail.com 22461968/32876651 9rnLi Like1977@hotmail.com 25136251 5rnYang Zhaoyang1982@hotmail.com 26539466 9rnVitaliy - - 2rnrnrn

http://pan.baidu.com/s/1kSfhrrnrn这是<em>一道</em>有关反汇编的题目。LZ初学汇编，基础很烂……rnrn学长又丢下这样<em>一道</em>BUG的题给我……rnrn关键语句已经找出来。就是关键call怎么都看不懂……（004016A3就是验证密码的call。这个call里有4个call，第4个不用管……关键在前3个call里）rnrn不求各位大神给我答案，帮我找出怎么通过call的验证和设计到算法的部分就OK了rnrn（如果能找到答案更加感谢……）rnrn还有一个小小的请求就是，希望能给我讲解下……不想只看答案……

1. 在一个a.txt文件中，放入一下字符串：rna 34rnaa 36rnaaa 28rnab 17rnaab 12rnbc 13rnbbc 25rncd 20rnccd 18rn要求输入一个字符串，输出所有可以用以上字符串组合而成的组合形式，并在其后输出其数字相加之和，如果没有，则不输出。rn例如输入：aaabcrn 输出：a aa bc 83rn aa a bc 83rn aaa bc 41rn a a a bc 115rn

Write a program to read in two floating point matrices A and B, which are of dimensions specified by thernuser. Dynamically allocate space for both input matrices.rnrnImplement 3 matrix operators: add, subtract and multiply, each of which should be implemented as arnfunction using call by reference. Devise appropriate tests within each function to determine whether thernoperator is valid for the dimensions specified - if not, an error should be printed.rnrnFull credit will only be given for solutions that follow the specification, but also where each part of thernprogram has been thoroughly tested, both with valid and invalid data. Use appropriate error messagesrnwhenever the user enters invalid data.rnrnHint: You need to devise a suitable structure to store the dimensions and the data of each matrix. Thernfunction call, for example, to multiply A and B together should be as simple asrnmultiply_matrix(A, B)rnwhere A and B are structures (or pointers to structures). You may choose simply to print out the result onrnthe screen, or store the result in a matrix C with a separate print_matrix function.rnrn上面这个是题目 就是让编个程序 能算2个矩阵的加减法和乘法rnrn老师要让用结构来表示矩阵a和b 好像还要用到malloc什么的 哎 我c学的太差了TTrnrn我想 是不是得弄3个函数来表示加 减和 乘法运算 然后 弄成下面这种样子- -rnint main (void)rnrn int opt;rn printf("1-Enter matrices A & B\n2-Add matrices\n3-Subtract matrices\n4-Multiply matrices\n5-Quit program\n");rn scanf("%d",&opt);rn while(opt=1)rn ....rn while(opt=2)rn ....rn ......rnrn return 0;rnrn最后的效果 应该是这样rn1-enter matrices A & Brn2-add matricesrn3-subtract matricesrn4-multiply matricesrn5-quit programrnrnrnoption 1rnrnnumber of rows in A: 2rnnumber of columns in A: 3rnEnter matrix data:rn1 2 3rn3 4 5rnrnrnnumber of rows in B: 2rnnumber of columns in B: 3rnEnter matrix data:rn4 3 2rn2 1 0rnrn1-enter matrices A & Brn2-add matricesrn3-subtract matricesrn4-multiply matricesrn5-quit programrnrnoption:2rnA+B= rn 5.0 5.0 5.0rn 5.0 5.0 5.0rnrn rn1-enter matrices A & Brn2-add matricesrn3-subtract matricesrn4-multiply matricesrn5-quit programrnrnoption: 3rnrnA-B=rn -3.0 -1.0 1.0rn 1.0 3.0 5.0rnrn1-enter matrices A & Brn2-add matricesrn3-subtract matricesrn4-multiply matricesrn5-quit programrn........

Problem DescriptionrnGive you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".rnrnInputrneach test case contains two numbers A and B.rnrnOutputrnfor each case, if A is equal to B, you should print "YES", or print "NO".rn 我的代码：rn#includern#includernint main()rnrn int l1,l2,i,j,L1,L2,ll1,ll2,lll1,lll2,f;rn char a[1100],b[1100];rn while(scanf("%s%s",&a,&b)!=EOF)rn rn L1=strlen(a);rn L2=strlen(b);rn l1=l2=-1;rn for(i=0;ill2;i--)rn rn if(b[i]!='0')rn rn f=0;rn printf("NO\n");rn break;rn rn rn if(f==1)rn rn if(ll1-l1==ll2-l2)rn rn f=1;j=l2;rn for(i=l1;ill1;i--)rn rn if(a[i]!='0')rn rn f=0;rn printf("NO\n");rn break;rn rn rn if(f==1)rn rn if(ll1-l1==ll2-l2)rn rn f=1;j=l1;rn for(i=l2;i=l1;i--)rn rn if(a[i]!='0')rn rn lll1=i;rn break;rn rn rn for(i=L2-1;i>=l2;i--)rn rn if(b[i]!='0')rn rn lll2=i;rn break;rn rn rn if(lll1-l1==lll2-l2)rn rn f=1;j=l2;rn for(i=l1;i);rn rn rn return 0;rn rn 想知道哪错了？？错误的测试数据举例？？rn题在：rnhttp://acm.hdu.edu.cn/showproblem.php?pid=2054rn rn rn rn

7．下面是一个整型堆栈类intStack的声明，请给出该类所有数据成员的类外定义。rnclass intStackrnpublic:rn intStack (int size=10);//构造函数rn ~intStack ();//析构函数rn bool Push(int elem);//入栈操作rn bool Pop(int &elem); //出栈操作rn int Length( ) const; //获取栈中元素的个数rnprivate:rn int *data; //指向动态数组的指针rn int top; //栈顶指针rn int size; //堆栈的容量rn;rnrnrn这个咋写啊？

炊事班的战士蒸馒头，每天要保证100个馒头才能完成队伍的吃饭任务，蒸的馒头顺序放到馒头筐里。炊事班战士蒸馒头的同时，陆续会有战士来餐厅就餐——从馒头筐里拿新出锅的馒头。如果此时没有馒头，战士就只能等待馒头出锅方可就餐。馒头筐不大，最多放置12个馒头，而且能保证新出锅的馒头最先被战士拿出。问题：1.请用面向对象的java语言描述如上这个问题，注意类的选择，类中属性和方法的确定2

1 建立一个表，包含1个字符型字段，一个整数型字段，一个日期型字段，一个Bool字段（其中字符型字段为主键）rnrn2 建立一个显示表中所有数据的页面（用Datagrid）,要求：rnrn 可以支持在线编辑（即EditCommand,CancelCommand,UpdateCommand)rnrn 可以增加数据，增加的时候在Datagrid的第一行增加一条空记录rnrn 每行显示一个删除链结，删除之前用Javascript提示用户确认rnrn3 另做一页，可以支持排序，当前排序的字段，在对应的列标题上显示上箭头或者下箭头rnrn 每20条记录一页，分页控件用自定义的控件，需要显示“首页”、“前页”、“下页”、“末页”。显示总页数和当前页号，用户可以输入新的页号并跳转rnrn4 在编辑状态下，Bool型字段用CheckBox显示，日期型字段既允许用户直接输入，也可以通过一个弹出窗口选择日期。rnrn可以用VS.net 2003或者2005，也可以用vb.net或者C#,数据库可以用SQL Server或者Accessrnrn假设此题目为某个客户提出来的，请给客户的系统管理员写一份安装指南rnrnrnrn rn

[align=center][/align]N! rnrnProblem Description rnGiven an integer N(0 ≤ N ≤ 10000), your task is to calculate N! rnrnrnrnInput rnOne N in one line, process to the end of file. rnrnrnrnOutput rnFor each N, output N! in one line. rnrnrnrnSample Input rn1 rn2 rn3 rnrnrnSample Output rn1 rn2 rn6 rn rn[align=left][/align]rn我的代码：rn#include rnint main()rnrn int a;rn __int64 sum;rn char c;rn while((c=getchar())!=EOF)rn rn scanf("%d",&a);rn sum=1;rn for(int i=1;i,&a)!=EOF)它根本就不会执行WHILE循环。rn我想高手能告诉我如何把上面的代码调整一下，使得我在输入完所有数据后，能整体的输出我要的答案。（输入的数据数目事先没有规定，是任意的。）rn谢谢高手~~！！！[/color]rn

DeviceID DeviceCatalogID DeviceBrand DeviceModel rn----------- --------------- ----------------------------------rn1 1 IBM 高端配制 rn2 1 IBM 中端配置 rnrnrnDevicePartID DeviceID DevicePartNamern------------ ----------- --------------------rn1 1 内存rn2 2 光驱rn3 1 显示器rn rnrnDeviceDetailID DevicePartID DeviceDetailDesc DeviceDetailPricern-------------- ------------ --------------------------------------rn2 1 1G三星内存 800.00rn3 2 128MPPT光驱 300.00rn5 3 方正纯平显示器 700.00rn6 1 128M三星内存 300.00rn7 1 512M三星内存 500.00rn现有三张表A,B,C 数据分别如上所示(关系是A表的DeviceID 对应 B表的DeviceID,B表的DevicePartID 对应C表的DevicePartID)rnrn要求做个复制操作即我要求原样复制一份 条件是A表的DeviceID = 1的记录 (注解:DeviceID =1 时对应B表有两条 对应C表有三条记录)rnrn想要的结果如下图所示:rnrnDeviceID DeviceCatalogID DeviceBrand DeviceModel rn----------- --------------- ----------------------------------rn1 1 IBM 高端配制 rn2 1 IBM 中端配置 rn3 1 IBM 高端配制 ---这是复制的结rnrnDevicePartID DeviceID DevicePartNamern------------ ----------- --------------------rn1 1 内存rn2 2 光驱rn3 1 显示器rn4 1 内存 -----这两条rn5 1 显示器 ----rnDeviceDetailID DevicePartID DeviceDetailDesc DeviceDetailPricern-------------- ------------ --------------------------------------rn2 1 1G三星内存 800.00rn3 2 128MPPT光驱 300.00rn5 3 方正纯平显示器 700.00rn6 1 128M三星内存 300.00rn7 1 512M三星内存 500.00rn8 1 1G三星内存 800.00 --- 这三条rn9 1 128M三星内存 300.00 ---rn10 1 512M三星内存 500.00 ---rnrn

public class Singleton rn private static Singleton obj = new Singleton();rn public static int counter1;rn public static int counter2 = 0;rn staticrn System.out.println(counter1+"------"+counter2);rn rn private Singleton()rn System.out.println(counter1+"------"+counter2);rn counter1++;rn counter2++;rn System.out.println(counter1+"------"+counter2);rn rn public static Singleton getInstance()rn return obj;rn rnrnpublic class MyMain rn public static void main(String[] args) rn Singleton obj = Singleton.getInstance();rn System.out.println("obj.counter1="+obj.counter1);rn System.out.println("obj.counter2="+obj.counter2);rn rnrnrn为什么在main中的答案是：obj.counter1=1rn obj.counter2=0rn啊？而且在静态代码块中也是前面为1后面为0，而在私有构造器中却是0和0，后面输出1和1?rn

[code=C/C++]void change(int const *p)rnrn*((int*)p) = 20;rnrnrnint main()rnrnint const x=10;rnchange(&x);rnprintf("%d",x);rnsystem("pause");rn[/code]rnrn在change函数里，*p的值已经改变为20了，但是出来后的输出结果还是10；为什么？

Each input file contains one test case. For each case, the first line contains a positive number N (< i; j++)rn rn for (k = i - K ; k < i; k++)rn rn if (j == k)rn continue;rn else if(s[j].score < s[k].score)rn s[j].lr += 1;rn rn rn location += 1;rn sum += K;rn rn rn rn for (i = 0; i < sum; i++)rn rn s[i].fr = 1;rn for (j = 0; j < sum; j++)rn rn if(i == j)rn continue;rn else if(s[i].score < s[j].score)rn s[i].fr += 1;rn rn rn rn rn printf("%d\n", sum);rnrn rn return 0;rn rn rn

js数组 [1,2,3] [5,6,7] 组合后变成一个新数组[15,16,17,25,26,27,35,36,37]

[size=13px][b]import java.util.Scanner;rnpublic class goodLuck rn public static void main(String[] args) rn int max=9999;rn int min=1000;rn int cardNumber=(int)(Math.random()*(max-min))+min;rn Scanner input=new Scanner(System.in);rn System.out.println("*******欢迎进入奖客富翁系统*******");rn System.out.println("请选择：");rn int No=input.nextInt();rn String name="";rn int password=0;rn switch(No)rn case 1:rn System.out.println("注册");rn System.out.println("请填写个人注册信息");rn System.out.println("用户名");rn name=input.next();rn System.out.println("密码：");rn password=input.nextInt();rn System.out.println("请记住您的注册信息：\n"+"用户名：\n"+(name)+"\n密码:\n"rn +(password)+"\n会员卡号\n"+(cardNumber));rn System.out.println("继续吗？");rn String answer=input.next();rn if(answer.equals("n"))rn System.out.println("谢谢使用，退出系统");rn rn case 2:rn System.out.println("登陆");rn System.out.println("请输入用户名：");rn String name1=input.next();rn System.out.println("请输入密码：");rn int password1=input.nextInt();rn for(int i=0;i);rn int[] num=new int[5];rn for(int i=0;;i++)rn for(i=0;i

int main()rnrn char c;rn char k;rn scanf("%c", &c);rn scanf("%c", &k);rn printf("%c %c\n", c, k);rn return 1;rnrnrn这里我比较好奇的是当我输入c的值为 'k',时候，结果是:rnkrnrn请按任意键继续...rnrn而输入"ky"时候，结果为：rnk yrn请按任意键继续...rnrnrn是否和输入函数和输入流有关系？如果我一定要实现分两次输入的话，请问如何解决？rn谢谢！

Mr. Moled has n column reservoirs underground, numbered from 1 to n. All of these reservoirs have a same sectional area. To connect these reservoirs, Mr. Moled digs m pipes. Each pipe connects exactly two reservoirs. And all the pipes are parallel with the ground. These pipes are so thin that they will not save any water. Now Mr. Moled will pour water into the reservoirs. You can assume the water passes through the pipes very quickly. Mr. Moled wants to know the height of the water in each reservoir at last.rnThings you should pay attention to:rn1. If water overflows sometime, the overflowed water will flow away and be lost.rn2. No two pipes have same depth. But a pipe may have same depth with one or two reservoirs which it connects.rn3. The reservoir’s sectional area is 1.rnInput （Please use standard input, and don’t read or write files.）rnThere are three integers in the first line, n, m and k.rnThe second line contains n integers, means the depth of each reservoir.rnThe next m lines each contains three integers, a, b and d. This means there is a pipe at the depth d connecting reservoir a with reservoir b.rnThe next k lines. In each line there are two integers, i and v, means Mr. Moled pours v water into the ith reservoir.rnOutput （Please use standard output, and don’t read or write files.）rnYou should output n lines and each line contains only one real number. The ith number means the volume of water in the ith reservoir. The answer should be rounded to two decimals.rnrnSample Inputrn5 4 3rn3 4 5 6 7rn1 2 3rn2 3 4rn3 4 5rn4 5 6rn3 2rn3 2rn5 7rnSample Outputrn0.20rn1.20rn2.20rn3.20rn4.20rnHintrnFor 100% cases, 0 < n < m < k <= 100rn原题如此，我就不画蛇添足翻译了。希望大家给点思路，或提示下应该用什么算法？
NOJ的一道求助大神
[img=https://img-bbs.csdn.net/upload/201710/14/1507982832_499734.png][/img]rn这是我写的程序 不知道为什么结果不对rn#includernusing namespace std;rnint sushu(int x)rnrn int i1;rn for(i1=2;i1>n;rn for(i=0;;i=i+100)for(j=1;j<

c++ 简单的一道题，求助
int   x=2,  y=x+30;nstruct An    static int  x;n    int  y;npublic:n    operator int( ) return x-y; n    A operator ++(int) return A(x++, y++); n    A(int x=::x+2, int y=::y+3) A::x=x;  A::y=y; n    int &h(int &x);n;nint &A::h(int &x)n    nfor(int y=1; y!=1|| x200)  x-=21; y-=2;n    return x-=10;nnint A::x=23;nvoid main( )n    A  a(54, 3),  b(65),  c;nnn求main函数里的a.x a.y b.x b.y c.x c.y的值，还有是不是在类里面定义的int y和构造里面定义的A::y不是一个东西？nn谢谢大神们n

[code=c]#include rnrnFILE *F15, *F500;rnint A[1024];rnrnbool checkSum(int count, int x, int *result) //count表示所添加为第几个元素 rnrn for (int i = 0; i= num-count;)rn rn if (count == num) //此时在添加最后一个元素 rn rn if (checkSum(count,arr[i], result))rn rn for (int j = num - 1;j >= 0;j--)rn rn fprintf(F,"%d\t",result[j]);rn rn fprintf(F,"\n");rn rn rn elsern rn if (checkSum(count,arr[i], result))rn rn getSubset(arr, i-1, result, count+1, num, len, F);rn rn getSubset(arr, i-1, result, count, num, len, F);rn rn rnrnrnint main()rnrn int a[500], a1[5], a2[10];rn for (int i=0; i);rn// getSubset(a,15-1,a1,1,5,15,F15);rn// fclose(F15);rn getSubset(a,500-1,a2,1,10,500,F500);rn fclose(F500);rn return 0;rn[/code]rnrn题目是本来有一个自然数数组，这里是1-500.然后在这个数组里面选取10个数，让这10个数的任意（共2^10次）组合所加的和都不想等。rn我的想法就是申请一个全局数列，然后分别从500开始试探添加元素，不符合条件，就换下一个数，如果符合条件就试探着再添加一个元素，直到10个找满为止。rn我觉得应该是属于回溯算法的吧，但是程序运行出错，哪位大神能解答帮助一下啊，小女子感激不尽

In the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with the following puzzle. They were given a 3-gallon jug and a 5-gallon jug and were asked to fill the 5-gallon jug with exactly 4 gallons. This problem generalizes that puzzle.rnrnYou have two jugs, A and B, and an infinite supply of water. There are three types of actions that you can use: (1) you can fill a jug, (2) you can empty a jug, and (3) you can pour from one jug to the other. Pouring from one jug to the other stops when the first jug is empty or the second jug is full, whichever comes first. For example, if A has 5 gallons and B has 6 gallons and a capacity of 8, then pouring from A to B leaves B full and 3 gallons in A.rnrnA problem is given by a triple (Ca,Cb,N), where Ca and Cb are the capacities of the jugs A and B, respectively, and N is the goal. A solution is a sequence of steps that leaves exactly N gallons in jug B. The possible steps arernrnfill Arnfill Brnempty Arnempty Brnpour A Brnpour B Arnsuccessrnrnwhere "pour A B" means "pour the contents of jug A into jug B", and "success" means that the goal has been accomplished.rnrnYou may assume that the input you are given does have a solution.rnrnInputrnrnInput to your program consists of a series of input lines each defining one puzzle. Input for each puzzle is a single line of three positive integers: Ca, Cb, and N. Ca and Cb are the capacities of jugs A and B, and N is the goal. You can assume 0 < Ca . Output lines start in column 1 and there should be no empty lines nor any trailing spaces.rnrnSample Inputrnrn3 5 4rn5 7 3rnrnrnSample Outputrnrnfill Brnpour B Arnempty Arnpour B Arnfill Brnpour B Arnsuccessrnfill Arnpour A Brnfill Arnpour A Brnempty Brnpour A Brnsuccessrnrn－－－－－－－－－－－－－－－－－－－－－－－－－－－rnrn据说用BFS可以求解，但我没有思路，这和BFS有什么联系？请给个思路，谢谢rnrn另外有更好的算法欢迎提出！

Create three classes named Book, Course and Student to perform course-selecting system. Student has at least three overloaded constructors with different parameter list. Student also has some members of Book.rnrnExamples:rn> java Course 13090001 Javarn13090001 choose Javarn> java Course 13090001 Java WebEngineeringrn13090001 choose Java and WebEngineeringrnrnrnNotes: You really need to add more information inside each class to get this working!rnrn主要搞不懂怎么和其他两个类发生关系
c语言编程
1.将数组A中的内容和数组B中的内容进行交换。（数组一样大） 2.取一个数二进制序列中所有的偶数位和奇数位，分别输出二进制序列。 3：将三个数按从大到小输出 4.求两个数的最大公约数。
C语言编程题

java精彩编程百例下载