| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2140 人关注过本帖
标题:[讨论]最新ACM考试题目,全球同时进行考试下午4 点半结束
取消只看楼主 加入收藏
其其公主
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-4-28
收藏
 问题点数:0 回复次数:5 
[讨论]最新ACM考试题目,全球同时进行考试下午4 点半结束

第一题
It is really amazing that the great historian Dr.K has recently found that about 10 Million years ago, in the area where is now called China, lived an ancient people. They may be considered as the first intelligent creature existed on the earth.

As Dr.K's investigation advance, he found unbelievably that they even developed some so-called mathematics during their evolvement. Dr.K spent his half life to understand this ancient people's counting system. Finally he got to know that:
1、They use only 7 digits to represent numbers, and numbers are as follow:
| -> 1
|| -> 2
||| -> 3
|||| -> 4
||||| -> 5
|||||| -> 6
||||||| -> 7
It is a pity that they have not developed "0" before these people disappeared.
2、If a number is greater than 7, they use digit place just as we do today. Between each two digit places, there is a ",".
eg:
|||||,|| -> 42 (5x8+2)
|||,||,|||| -> 212 (3*64+2*8+4)

In order to further his study, Dr.K wants to know what the sequences found from stones mean in today's counting system. He turns to you for help, and smart as you are, you should help this great historian,should not you?

Input

The first line of standard input contains an integer N, the number of test cases. N lines followed.
In each line a sequence is given, it is guaranteed that the length of the sequence will not exceed 1024 characters and the outcome number will not be greater than 1000000.

Output

For each case you are to output a line giving the number in today's decimal counting system.

Sample Input

3
|||||,||
|||,||,||||
||,|,|,|,||||


Sample Output

42
212
8780


第二题


Given a string of letters(A-Z),your task is to arrange them in alphabetic order.
Following is an example:
A string "BAC" contains 3 letters B,A and C,you should output
ABC
ACB
BAC
BCA
CAB
CBA
In the output file.
A string may contain several letters same,for example "BBC" you should output like this:
BBC
BCB
CBB

Input

The first line of input contains a single integer t, the number of test cases,followed by the input data for each test data.Each test case is a string of n(1<=n<=26) letters.

Output

You should output Case K: in the first line and the sequences of arrangement in the following lines of each case.

Sample Input

2
BAC
BBC

Sample Output

Case 1:
ABC
ACB
BAC
BCA
CAB
CBA
Case 2:
BBC
BCB
CBB

第三题


There are N(N<=50) good friends. One day they want to play together in one of their home. There may be road between two houses. We can describe a house as an vertex and a road as a edge between two vertexes. Every one goes at the same speed. At the very beginning, everyone stays at their own home. Now they want to play together as early as possible, that's to say they expect the latest one reach destination as early as possible. But they don't know whose house to get together in, can you help them?

Input

Input contains multiple cases. The first line is a integer T representing the number of test cases.The first line of each case contains two integers N and M. Then M lines follow. Each of the M lines contains three integers a, b, and c,which means that vertex a and b exist a edge whose distance is c.

Ouput

For each test case find which vertex to get together. If there is no such vertex print a single line "No solution." instead.

Sample Input

3
3 2
0 1 10
1 2 10
4 3
0 1 10
1 2 10
2 3 10
4 2
0 1 5
2 3 7

Sample Output

1
1
No solution.


第四题

There are n tasks {1,2,3...,n} waiting in line to be operated on the computer. Task i needs Ti CPU time to be finished. Your task is to find a way to maximize the number of tasks can be finished in time T. If there are more than one way containing maximum tasks, then maximize the CPU time used in time T.

Input

The first line contains a integer t (1<=t<=100), the number of test cases. The first line of each case contains integer n and T, representing n tasks and in time T the maximum tasks can be finished and the maximum CPU can be used. The second line of each case contains the time {T1,T2,T3...Tn} each task needs to be finished. All numbers are integer in the input file.

Output

For each test case, output a line with the maximum number of tasks can be finished and the maximum of CPU time can be used in time T. One test case per line and separated by one whitespace.

Sample input

1
7 47
30 78 33 76 66 8 78

Sample Onput

2 41


第五题


There are two sequences A and B with N (1<=N<=10000) elements each. All of the elements are positive integers. Given C=A*B, where '*' representing Cartesian product, c = a*b, where c belonging to C, a belonging to A and b belonging to B. Your job is to find the K'th largest element in C, where K begins with 1.

Input

Input file contains multiple test cases. The first line is the number of test cases. There are three lines in each test case. The first line of each case contains two integers N and K, then the second line represents elements in A and the following line represents elements in B. All integers are positive and no more than 10000.

Output

For each case output the K'th largest number.

Sample Input

2
2 1
3 4
5 6
2 3
2 1
4 8

Sample Output

24
8

搜索更多相关主题的帖子: ACM 考试 全球 结束 
2007-04-28 15:40
其其公主
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-4-28
收藏
得分:0 
请大家集思广益啊,解决这些问题啊
2007-04-28 15:41
其其公主
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-4-28
收藏
得分:0 

第一题最难,后面的简单点

2007-04-28 15:46
其其公主
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-4-28
收藏
得分:0 

哥哥姐姐,帮其其做做题啊!

2007-04-28 15:56
其其公主
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-4-28
收藏
得分:0 

第一题,已经做出来了

#include <iostream>
#include <string>
//nclude <math.h>
#include <iomanip>
using namespace std;

int main ()
{
int C;
cin >> C;
while(C--)
{
string s;
cin >> s;
int N = s.length();
//cout << N << endl;
long sumAll=0;
long pow=1;
int sum=0;
//cout << s[N-1]<< endl;
while(--N >= 0)
{
if(s[N]=='|')
sum++;
else if(s[N]==',')
{
sumAll+=sum*pow;
//cout << sumAll << endl;
sum=0;
pow=pow*8;
}

if(N==0)
{
sumAll+=sum*pow;
//cout << sumAll << endl;
sum=0;
}
}
cout << sumAll<< endl;
}
return 0;
}

2007-04-28 15:58
其其公主
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-4-28
收藏
得分:0 
下面的题目,我的时间来不及了,大家快救急啊
2007-04-28 15:59
快速回复:[讨论]最新ACM考试题目,全球同时进行考试下午4 点半结束
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034394 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved