Search found 5 matches

by capella
Sat Jul 12, 2003 9:21 am
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30411

Thanks Ryan Pai!

There r 8 triples for n=25.

Thanks so much for Ryan Pai's message just now!!! Yes my problem is indeed that I should use % in cop but not substracting and substracting. I got AC finally!!! So happy :D , though it takes 8 seconds :oops:
by capella
Sat Jul 12, 2003 4:16 am
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30411

the output

hi Rav if you are looking for the output for n=1000000 here is another post containing this

http://online-judge.uva.es/board/viewtopic.php?t=2293


But can anyone answer my previous question?
Now I have changed my code as:
[c]
up=sqrt(n/2);
for(int b=1;b<=up;b++)
for(int a=b+1;(z=a*a+b*b)<=n ...
by capella
Sun Jul 06, 2003 10:53 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30411

Can you tell me what should I do with this?

I'm sorry that I don't have much concept about efficiency. I wonder how it runs on my computer. But if I don't do like this, how can I deal with the seen array? It seem the formula a*a-b*b,2*a*b,a*a+b*b doesn't generate all triple, such as 9,12,15.
Thanks.
by capella
Fri Jul 04, 2003 10:20 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30411

help on 106, it works well on my comp, but I got TLE

This program runs quickly on my computer, but I continously get Time Limit Exceeded. It's weird. Can anyone help me try it on your computer?[cpp]
#include<iostream>
#define MAX 1000001

using namespace std;

int cop(int p, int q){
if(p%2==0 && q%2==0) return 0;
if(p<q) p=p+q,q=p-q,p=p-q;

while ...
by capella
Thu Jun 19, 2003 6:56 am
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 50494

need help on 103 -- WA WA...

i use DP. i can't figure out what test case can make it get WA. :cry: can anyone help me? sincerely thanks!
[cpp]
#include<iostream>
#include<string.h>
using namespace std;

unsigned long box[30][10]; //stores the size of each box
int arrbox[10]; //the i'th smallest box is of index arrbox comparing ...

Go to advanced search