Search found 78 matches

by mido
Tue May 20, 2003 12:47 pm
Forum: Volume 104 (10400-10499)
Topic: 10491 - Cows and Cars
Replies: 17
Views: 8744

Quite easy, but can get very annoying. To solve it, I thought about the probabilities of the paths one might take in each case. This helped me get to the solutions presented in the sample output. Continue thinking from there....
by mido
Thu Apr 10, 2003 1:33 am
Forum: Volume 104 (10400-10499)
Topic: 10405 - Longest Common Subsequence
Replies: 103
Views: 30803

Thanks guys...I got to find out what LCS is all about; this problem is a textbookexample for this type of algorithm...thanks again...:)
by mido
Tue Feb 25, 2003 4:32 pm
Forum: Volume 3 (300-399)
Topic: 343 - What Base Is This?
Replies: 72
Views: 22253

I've got AC...here'e some tips :

.Minimum base is 2
.while there are still digits
result= result* current testing base + value of digit
.Go to http://www.comp.nus.edu.sg/~stevenha/

Hope it helps
by mido
Sat Feb 22, 2003 5:43 pm
Forum: Volume 6 (600-699)
Topic: 623 - 500!
Replies: 187
Views: 46502

Got AC finally....just one more brute force check needed at the end...:)
by mido
Mon Feb 17, 2003 11:55 am
Forum: Volume 6 (600-699)
Topic: 623 - 500!
Replies: 187
Views: 46502

623 again

Anything wrong here...: [cpp] #include <iostream.h> void main() { long n,i,count=0; while (!cin.eof() && cin>>n && !cin.fail()) { if (count) cout<<endl; count++; int len=1; int longI[100001]; int longI_temp[100001]; for (i=0;i<100001;i++) { longI =0; longI_temp =0; } longI[100001-1]=1; for (i=n;i>=1...
by mido
Mon Feb 17, 2003 12:15 am
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 26042

I got AC so need to bother...for those who want to know, this code has just a 2-level for loop left for the solution to get AC...good luck.. :D
by mido
Sun Feb 16, 2003 8:34 pm
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 26042

108 again

What's wrong with this...?...: [cpp] #include <iostream.h> void main() { long dim; while (!cin.eof() && cin>>dim && !cin.fail()) { long list[110][110]; long list_sum[110][110]; long sum=0; long i,j; long max=-127*1000; for (j=0;j<dim;j++) { cin>>list[0][j]; sum+=list[0][j]; list_sum[0][j]=sum; max =...
by mido
Sun Feb 16, 2003 2:21 pm
Forum: Volume 104 (10400-10499)
Topic: 10405 - Longest Common Subsequence
Replies: 103
Views: 30803

10405 again

What's wrong with this...: [cpp]#include <iostream.h> #include <string.h> void main() { char* str=new char[1100]; char* str2=new char[1100]; while (!cin.eof()) { /*char ch; while (cin.get(ch) && (ch==' ')) {} if (cin.eof()) break; cin.putback(ch); ch=0; while (cin.get(ch) && (ch==' ')) {} cin.putbac...
by mido
Fri Feb 14, 2003 2:35 am
Forum: Volume 5 (500-599)
Topic: 530 - Binomial Showdown
Replies: 137
Views: 35217

I got AC by changing the value of k so as to decrease the number of iterations..just a little combination trick (a friend of mine did it for me, actually)...thanks (btw,from TLE to zero seconds..whoof)
by mido
Thu Feb 06, 2003 1:24 pm
Forum: Volume 5 (500-599)
Topic: 541 - Error Correction
Replies: 27
Views: 12251

I did just that...major thanks!!!!
by mido
Wed Feb 05, 2003 3:09 pm
Forum: Volume 103 (10300-10399)
Topic: 10302 - Summation of Polynomials
Replies: 29
Views: 15516

10302 again

Anything wrong with this: [cpp] #include <iostream.h> #include <stdio.h> #include <math.h> long long num, i,j; long long sum; void main() { while (!cin.eof() && cin>>num && !cin.fail()) { sum=0; for (i=0;i<=num;i++) { long temp=1; for (j=0;j<3;j++) temp*=i; sum+=temp; } cout<<sum<<endl; } } [/cpp]
by mido
Wed Feb 05, 2003 11:59 am
Forum: Volume 5 (500-599)
Topic: 541 - Error Correction
Replies: 27
Views: 12251

541 - Error Correction

Is there something I can't see here...here's my code: [cpp] #include <iostream.h> void main() { int list[100][100]; int row[100]; int col[100]; int dim; int i,j,badrow_count,badrow_index,badcol_count,badcol_index; while (cin>>dim && dim>0) { badrow_count=0; badcol_count=0; for (i=0;i<dim;i++) row =c...
by mido
Wed Jan 29, 2003 3:14 pm
Forum: Volume 5 (500-599)
Topic: 530 - Binomial Showdown
Replies: 137
Views: 35217

530 again

This gives TLE...any tips:
[cpp]
#include <iostream.h>

long num,k,i;
double result;

void main()
{
while (!cin.eof() && cin>>num>>k && num>=1 && k>=0)
{
result=1;
for (i=1;i<=k;i++)
{
result*=num;
result/=i;
num--;
}
cout<<long(result)<<endl;
cout.flush();
}
}
[/cpp]
by mido
Fri Sep 27, 2002 2:30 pm
Forum: Volume 103 (10300-10399)
Topic: 10363 - Tic Tac Toe
Replies: 54
Views: 25171

You're very welcom..:)
by mido
Wed Sep 25, 2002 4:24 pm
Forum: Volume 103 (10300-10399)
Topic: 10363 - Tic Tac Toe
Replies: 54
Views: 25171

Semi-Spoiler:

What should be the status of the board if :

If x wins.
If o wins.
If neither win.
If both win???...can't happen..:)

Think and good luck.

Go to advanced search