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 , though it takes 8 seconds
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.
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;
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 ...