Ok I'm sorry but I'm still having some problems understanding that formula. i think i understand it now to mean
a log(a) b = log(a) b / log(a) a
where the a in parenthesis means log(base a) of.
PS: a in a log b is the base of the log
so using natural logs, it seems that the formula would be ...
Search found 6 matches
- Thu Oct 09, 2003 6:45 pm
- Forum: Volume 1 (100-199)
- Topic: 113 - Power of Cryptography
- Replies: 163
- Views: 51099
- Thu Oct 09, 2003 3:46 am
- Forum: Volume 1 (100-199)
- Topic: 113 - Power of Cryptography
- Replies: 163
- Views: 51099
- Mon Oct 06, 2003 9:01 pm
- Forum: Volume 1 (100-199)
- Topic: 113 - Power of Cryptography
- Replies: 163
- Views: 51099
another 113 problem
This program is a one-liner for the most part, but the judge keeps giving me wrong answer with this code. I've tested it with other inputs and get correct outputs. what am i doing wrong?
[cpp]
long k;
short n;
double p;
while(cin >> n >> p)
{
if(p==1)
{ cout << 1 << endl; continue;}
if(n==1 ...
[cpp]
long k;
short n;
double p;
while(cin >> n >> p)
{
if(p==1)
{ cout << 1 << endl; continue;}
if(n==1 ...
- Mon Oct 06, 2003 4:36 am
- Forum: Volume 1 (100-199)
- Topic: 107 - The Cat in the Hat
- Replies: 278
- Views: 55504
There is an analytic solution of sorts, although i have no idea of it's efficiency. if you express the two equations with natural logs, you'll get an equation of the form N^c - N -1 = 0, where N is the number of cats in each hat and c is the ratio of the natural logs of the two input constants. You ...
- Tue Sep 16, 2003 9:48 pm
- Forum: Volume 1 (100-199)
- Topic: 144 - Student Grants
- Replies: 21
- Views: 6563
Problem 144 -- Recycling the Source
When filling a student's grant completely, doesn't empty the output store, how many coins will the reserve spit out when the store does empty? For example:
Student 1 has $39. The machine store has $2. Filling student 1's grant leaves $1 in the output store. Student 2 gets the $1 from the store. Now ...
Student 1 has $39. The machine store has $2. Filling student 1's grant leaves $1 in the output store. Student 2 gets the $1 from the store. Now ...
- Mon Sep 15, 2003 3:38 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320040
Problems 100, 118 -- terminating standard input, C++
I don't know an elegant way to control a loop based on reaching the end-of-file of the standard input. I think this is the reason I got consistent WA's on problem 100, so I gave up until the same thing comes up on 118.
For 100 i was doing
int firstnum, lastnum;
while( cin>>firstnum>>lastnum ...
For 100 i was doing
int firstnum, lastnum;
while( cin>>firstnum>>lastnum ...