上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 34 下一页
摘要: 描述记得上小学奥数时,JacmY最喜欢做的题就是给一个图形,从它某一个顶点出发描这个图形,若恰通过图中每条边一次,看最后能否又回到起点。当时JacmY只懂得拿着铅笔随便画画试试,如果成功了,就说这个图能画下来,而他判断不能画下来的标准就是费了半天功夫都画不出来,当然这么做是不对的,特别当图形变得复杂时,JacmY是试不过来的。看着可怜的JacmY,你能帮帮他吗? 输入第一行一个整数T代表样例的组数。以下T组数据中,每组第一行是N,K,(2 using namespace std;int main(){ int test; int n,k,i,x,y; cin>>test; ... 阅读全文
posted @ 2013-11-22 09:45 七年之后 阅读(431) 评论(0) 推荐(0) 编辑
摘要: 描述在n×n方阵里填入1,2,…, n×n,要求填成蛇形(见样例)。 输入输入正整数n,n≤64。输出输出蛇形矩阵,要求每个数格式宽度为5、右对齐。样例输入4样例输出10 11 12 1 9 16 13 2 8 15 14 3 7 6 5 4#include #include #include #include #define MAXN 65 using namespace std;int a[MAXN][MAXN]; int main() { int n, x, y, val=0; cin>>n; memset(a,0,sizeof(a));... 阅读全文
posted @ 2013-11-22 09:43 七年之后 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 描述This problem is based on the game of Black Vienna. In this version there are three players and 18 cards labeled A-R. Three of the cards are set aside (hidden) and form the "Black Vienna" gang. The remaining cards are shuffled and dealt to the players so that each player has 5 cards. Play 阅读全文
posted @ 2013-11-22 09:42 七年之后 阅读(645) 评论(0) 推荐(0) 编辑
摘要: 描述Rock, Paper, Scissors is a classic hand game for two people. Each participant holds out either a fist (rock), open hand (paper), or two-finger V (scissors). If both players show the same gesture, they try again. They continue until there are two different gestures. The winner is then determined ac 阅读全文
posted @ 2013-11-22 09:37 七年之后 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 描述The company Al's Chocolate Mangos has a web site where visitors can guess how many chocolate covered mangos are in a virtual jar. Visitors type in a guess between 1 and 99 and then click on a "Submit" button. Unfortunately, the response time from the server is often long, and visitor 阅读全文
posted @ 2013-11-22 09:35 七年之后 阅读(327) 评论(0) 推荐(0) 编辑
摘要: 描述In the book All Creatures of Mythology, gnomes are kind, bearded creatures, while goblins tend to be bossy and simple-minded. The goblins like to harass the gnomes by making them line up in groups of three, ordered by the length of their beards. The gnomes, being of different physical heights, var 阅读全文
posted @ 2013-11-22 09:33 七年之后 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 描述现在我们来玩一个游戏:传播“悄悄话”,规则如下:(1)一个人发起“悄悄话”(2)一个人在知道“悄悄话”时,要么保持沉默,不告诉任何人;要么在规定时间内将“悄悄话”及时告诉其他两个人,否则游戏失败。(3)所有人最终都知道“悄悄话”假设一个人在规定时间内至多将“悄悄话”告诉两个人;除发起人外,其他每个人只被告诉一次“悄悄话”。给定游戏的统计数据,请你判断游戏是否成功。输入第一行是一个正整数:测试用例数目,最多为3。之后,每个测试用例包括多行:l 第1行给出两个整数(空格分割),前者表示游戏参与人数n,后者表示“悄悄话”的发起人t,在这个游戏中,参加人用整数序号表示,2≤n≤10001,0≤t≤ 阅读全文
posted @ 2013-11-22 09:32 七年之后 阅读(688) 评论(0) 推荐(0) 编辑
摘要: 描述给定任何不可被2或者5整除的整数n(0 int main(){ int n; while(scanf("%d",&n)!=EOF) { int t=1; int count=1; while(t) { t=(t*10+1)%n; count++; } printf("%d\n",count); } return 0;} 阅读全文
posted @ 2013-11-22 09:30 七年之后 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 描述sed同学最近迷上了制造机器狗,购置了大量所需零件,零件可以组装为一个组件,这些组件或零件又可以组装为一个大的组件。在制造机器狗中,组件或零件只能两两进行组装,组装的顺序任意。在机器狗中,每个零件都有一个组装成本,每次组装一个组件的费用为各个零件组装成本之和。给定各个零件组装成本(单位为元),你的任务是帮助sed计算他至少花费多少费用。输入第一行包括一个整数N,表示机器狗零件数(1≤N≤10000)第二行为N个正整数,表示每个机器狗零件组装成本(单位为元),整数之间用空格隔开。输出输出仅一行,即机器狗组装的最少费用。注意:输出部分的结尾要求包含一个多余的空行。样例输入10 1 2 3 4 阅读全文
posted @ 2013-11-22 09:30 七年之后 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 描述现代社会通信便捷,借助于Internet形成了各式各样的社区,每个人都可能属于多个社交圈,尤其是Facebook类社交网站的出现,使世界缩小了,人与人的交往扩大了频繁了。sed同学正在做这方面的毕业设计课题,指导老师给他布置了一个任务:已知一群人的社会关系网络,判断两个人之间的关系,他们是否可以通过社交圈的人相互结识。输入第一行包括三个整数:n、 m、k,分别表示人数、社区数、查询两个人之间的关系的用例数 (1 ≤ n ≤ 10000, 0 ≤ m ≤ 100,1 ≤ k ≤ 100)。m行,每行首先给出一个社区的人数,然后给出代表人的序号。k行,每行给出待查询的两个人(用序号表示)。输出 阅读全文
posted @ 2013-11-22 09:28 七年之后 阅读(551) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 34 下一页