
acm程序设计
文章平均质量分 75
老白号
VoltDB工程师
展开
-
c++实习的作业
大一上学期学了c++,下学期要实习,而实习题目就是acm(toj)上的9道题,附加一个纸牌游戏的类网址:http://acm.tju.edu.cn Program 1: Web Navigation (TOJ_1196) Standard web browsers contain features to move backward and forward among the原创 2008-03-16 16:50:00 · 2636 阅读 · 0 评论 -
Gridland c++
BackgroundFor years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them efficient algorithms are already available, these are the "e原创 2008-05-03 00:02:00 · 803 阅读 · 1 评论 -
Mileage Bank
Mileage program of ACM (Airline of Charming Merlion) is really nice for the travelers flying frequently. Once you complete a flight with ACM, you can earn ACMPerk miles in your ACM Mileage Bank depe原创 2008-05-03 00:07:00 · 2645 阅读 · 1 评论 -
A Mathematical Curiosity
Given two integers n and m, count the number of pairs of integers (a,b) such that 0 a b n and (a2+b2+m)/(ab) is an integer. InputYou will be given a number of cases in the input. Each case原创 2008-05-03 00:14:00 · 805 阅读 · 0 评论 -
Goldbach's Conjecture
In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: Every even number greater than 4 can be written as the sum of原创 2008-05-03 00:18:00 · 538 阅读 · 0 评论 -
Currency Exchange
When Issac Bernand Miller takes a trip to another country, say to France, he exchanges his US dollars for French francs. The exchange rate is a real number such that when multiplied by the number of原创 2008-05-03 00:19:00 · 748 阅读 · 0 评论 -
Number Steps
Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2,... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1)原创 2008-05-03 00:21:00 · 1267 阅读 · 0 评论 -
Parencodings
Let S = s1 s2 ... s2n be a well-formed string of parentheses. S can be encoded in two different ways: By an integer sequence P = p1 p2 ... pn where pi is the number of left parentheses原创 2008-05-03 00:22:00 · 598 阅读 · 0 评论 -
DNA Sorting
One measure of "unsortedness" in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence "DAABEC", this measure is 5, sinc原创 2008-05-03 00:08:00 · 594 阅读 · 0 评论 -
Sum of Factorials
John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics, meteorol原创 2008-05-03 00:12:00 · 702 阅读 · 0 评论 -
Error Correction
A boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Heres a 4 x 4 matrix which has the parity property: 1 0 1原创 2008-05-03 00:17:00 · 697 阅读 · 0 评论 -
Rotten Ropes
Suppose we have n ropes of equal length and we want to use them to lift some heavy object. A tear-off weight t is associated to each rope, that is, if we try to lift an object, heavier than t with t原创 2008-05-03 00:27:00 · 1127 阅读 · 0 评论 -
Beavergnaw
When chomping a tree the beaver cuts a very specific shape out of the tree trunk. What is left in the tree trunk looks like two frustums of a cone joined by a cylinder with the diameter the same as i原创 2008-05-03 00:30:00 · 912 阅读 · 0 评论 -
A DP Problem Asia - Tehran 2003
In this problem, you are to solve a very easy linear equation with only one variable x with no parentheses! An example of such equations is like the following:2x - 4 + 5x + 300 = 98xAn express原创 2008-05-03 00:28:00 · 909 阅读 · 0 评论 -
Niven Numbers
A Niven number is a number such that the sum of its digits divides itself. For example, 111 is a Niven number because the sum of its digits is 3, which divides 111. We can also specify a numbe原创 2008-05-03 00:15:00 · 2322 阅读 · 1 评论 -
Octal Fractions c++ ACM
#include #include #include using namespace std; int main(){ string s; vector a; while (1){ getline(cin,s); if(cin.fail())break; s = s.substr(2);原创 2008-03-23 23:16:00 · 797 阅读 · 0 评论 -
Soundex c++ ACM
#include #include using namespace std;int a[26]={-1,1,2,3,-1,1,2,-1,-1, 2,2,4,5,5,-1,1, 2,6,2,3,-1,1,-1, 2,-1,2};int main(){ string str,out; int i,k; while(cin原创 2008-03-23 23:17:00 · 1021 阅读 · 0 评论 -
Psuedo-Random Numbers c++ ACM
#include using namespace std; int main(){ int Z, I, M, L ; int temp, count ,next; int index = 1 ; while (1) { scanf( "%d %d %d %d" , &Z, &I, &M, &L) ; if (Z==0 && I==0原创 2008-03-23 23:18:00 · 649 阅读 · 0 评论 -
Transmitters c++ ACM
#include using namespace std; int p[150][2];int main(){ int x,y,n,ans,i,j,k,a,b,dstn; double r; while(cin>>x>>y>>r && r>0){ cin>>n; k=ans=0; for(i=0;i cin>>a>>b; if ((x-a)*(x-a)+(y-b)*(y-b)原创 2008-03-23 23:19:00 · 456 阅读 · 0 评论 -
Robots c++ ACM
Your company provides robots that can be used to pick up litter from fields after sporting events and concerts. Before robots are assigned to a job, an aerial photograph of the field is marked with原创 2008-03-23 23:22:00 · 617 阅读 · 0 评论 -
A DP Problem c++ ACM
Program 3: A DP Problem (TOJ_1283) In this problem, you are to solve a very easy linear equation with only one variable x with no parentheses! An example of such equations is like the following原创 2008-03-23 23:23:00 · 1004 阅读 · 0 评论 -
Friends c++ ACM
Program 4: Friends (TOJ_2469)There are some people traveling together. Some of them are friends. The friend relation is transitive, that is, if A and B are friends, B and C are friends, then A an原创 2008-03-23 23:24:00 · 1062 阅读 · 0 评论 -
C/C++ 程序设计
C/C++ 程序设计实习报告 C/C++ Programing Practice Report Group BPractice ⅠProgram 1: Web Navigation (TOJ_1196)解题方法:本题是道简单题,要模拟网页的打开,后退,以及前进的功能,道理很简单,和我们常用的IE浏览器一样原创 2008-03-23 23:26:00 · 942 阅读 · 0 评论 -
City hall
my c++ code:#include #include using namespace std; int main(){ int m,n; scanf("%d%d",&m,&n); string *str=new string [m]; int *ans = new int [m]; for(int i=0;i<m;i+原创 2008-05-03 00:04:00 · 914 阅读 · 0 评论 -
Binomial Showdown
In how many ways can you choose k elements out of n elements, not taking order into account? Write a program to compute this number.Input SpecificationThe input file will contain one or more test原创 2008-05-03 00:10:00 · 907 阅读 · 0 评论 -
Word Reversal
For each list of words, output a line with each word reversed without changing the order of the words. InputYou will be given a number of test cases. The first line contains a positive i原创 2008-05-03 00:13:00 · 1494 阅读 · 0 评论