Using KISS :)
http://en.wikipedia.org/wiki/KISS_principle
Ps: is not an offensive message
Wladimir Araujo Tavares
*Federal University of Ceará http://lia.ufc.br/%7Ewladimir/
Homepage http://lia.ufc.br/%7Ewladimir/ |
Maratonahttps://sites.google.com/site/quixadamaratona/|
*
On Fri, Sep 28,
@Wladimir : you have to use formula given in below link
http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle
On Fri, Sep 28, 2012 at 12:26 AM, Wladimir Tavares wladimir...@gmail.comwrote:
what happens when a = 3, d = 5
a, a + d, d +2, a +3 d = 3,8,13,18?
Wladimir Araujo
why not just brute force this? one little array contains [a, (a+d),
(a+2d), (a+3d), (a+4d) ], which is then filtered so that none of those are
multiples of another.
Then set a count variable to m-n+1. Check all numbers in range against
your little array, decrementing count and breaking out if a
thanks for your reply.. actually i was thinking the same thing.. but I am
facing problems in finding the unique multiples of a+3d and a+4d as
applying inclusion exclusion principle in this way is getting too difficult
due to large no of factors to be added and subtracted.. is der any other
@ashish : here is the generalized equation
http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle
note : you need to take LCM of a,a+d,a+2d etc etcwhenever you are
dividing to find count
On Thu, Sep 27, 2012 at 2:55 AM, ashish pant asheesh...@gmail.com wrote:
thanks for
what happens when a = 3, d = 5
a, a + d, d +2, a +3 d = 3,8,13,18?
Wladimir Araujo Tavares
*Federal University of Ceará http://lia.ufc.br/%7Ewladimir/
Homepage http://lia.ufc.br/%7Ewladimir/ |
Maratonahttps://sites.google.com/site/quixadamaratona/|
*
On Thu, Sep 27, 2012 at 8:57 AM, atul
an idea of the approach would be enough.. plz help..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
help needed in spoj problem EASYMATH http://spoj.pl/problems/EASYMATH.. i
thought about inclusion exclusion principle but unable to get to a
solution.. plz help..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the
please suggest something :
Problem :
http://www.spoj.pl/problems/EASYMATH/
C++ code :
http://ideone.com/r2OSb
was getting wrong ans due to over flow i think in LCM() for big prime's i guess.
thin tried in python .
Now getting NZEC for python code which mean's high level or recurrsion
some
use return (a/gcd(a,b)*b instead
On Sun, Jun 24, 2012 at 7:10 PM, Sourabh Singh singhsourab...@gmail.comwrote:
please suggest something :
Problem :
http://www.spoj.pl/problems/EASYMATH/
C++ code :
http://ideone.com/r2OSb
was getting wrong ans due to over flow i think in LCM() for big
dont post codes, ask whether your algorithm is correct or not.
On Sun, Jun 24, 2012 at 8:29 PM, Hassan Monfared hmonfa...@gmail.comwrote:
use return (a/gcd(a,b)*b instead
On Sun, Jun 24, 2012 at 7:10 PM, Sourabh Singh
singhsourab...@gmail.comwrote:
please suggest something :
Problem
@MAYANK your output format is wrong.use printf(\nScenario #%d:\n,(i+1));
and
if(sum sta)
On Thu, Jun 21, 2012 at 12:34 PM, Mayank Singh
singh13490may...@gmail.comwrote:
here is my code
/*#includestdio.h
#includeconio.h
int main()
{
int cand,sum;
int T,N,i,j,temp[10];
use if(sum sta) instead of if(sum=sta)
because in case sum==sta..your code will still increment p .but the value
of p should not be incremented in this case.and in your output format colon
: should be placed before \n to follow the format specified for the problem.
On Fri, Jun 22, 2012 at 12:48
in this prob also
for i=0, i to k
read cand
rem=(rem+cand)%k
if (rem) then no
else yes
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send
my code is running perfectly well but giving WA in spoj..
#includestdio.h
#includestdlib.h
int main()
{
int cand,sum;
int T,N,i,j,temp[10];
scanf(%d,T);
sum = 0;
for(i=0;iT;i++)
{
scanf(%d,N);
for(j=0;jN;j++)
{
scanf(%d,cand);
i think you should try to give output for each test case rather to use any
temp array
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email
here is my code :
#includestdio.h
#includestdlib.h
int main()
{
long long cand,sum;
int T,N,i,j,*temp;
scanf(%d,T);
temp= (int*)calloc(T, sizeof( int));
sum = 0;
for(i=0;iT;i++)
{
scanf(%d,N);
for(j=0;jN;j++)
{
scanf(%lld,cand);
Initialize sum as zero for all test cases ie inside 1st for loop.
On Jun 21, 2012 5:22 PM, Mayank Singh singh13490may...@gmail.com wrote:
here is my code :
#includestdio.h
#includestdlib.h
int main()
{
long long cand,sum;
int T,N,i,j,*temp;
scanf(%d,T);
temp=
@Mayank coding style not seems gud.. try this...
int main()
{
int testCases;
scanf(%d,testCases);
while(testCases--0)
{
//perform ur logic
//print output for each test case here instead of storing it into
an array.
}
}
return 0;
}
On Thu, Jun 21, 2012 at 10:35 PM,
i am using long long but still getting WA.
here's my code
#includestdio.h
#includeconio.h
int main()
{
long long cand,sum;
int T,N,i,j,temp[10];
scanf(%d,T);
sum = 0;
for(i=0;iT;i++)
{
scanf(%d,N);
for(j=0;jN;j++)
{
long long not require in this que .
try it again..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
still getting the WA .
is there any test case i am getting wrong?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
here is my code u can check that..
http://ideone.com/Gii1d
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
@mayank:
For each testcase sum is not zero make sum=0 inside the for loop
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
oh i am really sorry
the problem is CANDY III
can you help me regarding that
once again sorry
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from
here is my code:
#includestdio.h
#includestring.h
#includestdlib.h
int main()
{
int t,i,j,k1,k2,ans[40],sum,sum1;
char str[40][20],str1[6],str2[6];
scanf(%d,t);
for(i=0;i=t;i++)
{
gets(str[i]);
}
for(i=1;i=t;i++)
{
for(j=1,k1=0;j15,k15;j=j+3,k1++)
here is my code for the above problem:
#includestdio.h
#includestdlib.h
int main()
{
int i,x[1],y[1],val;
long n;
scanf(%d,n);
for(i=0;in;i++)
{
scanf(%d,x[i]);
scanf(%d,y[i]);
}
for(i=0;in;i++)
{
if(x[i] == y[i] x[i]%2 == 0)
array size not sufficient coz n can be greater than 1
try x[100], y[100] :-)
On Sun, Jun 17, 2012 at 9:32 PM, Mayank Singh
singh13490may...@gmail.com wrote:
here is my code for the above problem:
#includestdio.h
#includestdlib.h
int main()
{
int i,x[1],y[1],val;
plz nyone explain how to approach this problem..
http://www.spoj.pl/problems/XORROUND/
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email
@ashish pant
We must compute all the queries in O(n)+O(k).
We must have array like counting array.
It is not my logic but my friend told about this logic
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
No one is going to check my your code
Don't submit my code directly to spoj ,,,Learn from it...and then
make your own code..
#includeiostream
#includevector
#includeset
#includemap
#includequeue
#includestack
#includestring
#includealgorithm
#includefunctional
#includeiomanip
problem is http://www.spoj.pl/problems/ELEVTRBL/
and my solution is give wrong answer on spoj . Plz help me to find in which
case my solution give wrong answer.
*
#includeiostream
**
#includestdio.h
using namespace std;
int main()
{
long long int f,s,u,d,g,c,p;
what;s your algorithm ?
On Mon, Nov 14, 2011 at 7:57 PM, Anshul AGARWAL
anshul.agarwa...@gmail.comwrote:
problem is http://www.spoj.pl/problems/ELEVTRBL/
and my solution is give wrong answer on spoj . Plz help me to find in
which case my solution give wrong answer.
*
#includeiostream
**
i m try to increase current floor c by push up button until it equal or
greater than g and increase co-responding push p.when my current
floor is greater than g.i push down button once and increase p by 1.
repeat this loop until i get c==g.
*Anshul Agarwal
Nit Allahabad
Computer Science**
*
one solution is use BFS
On Mon, Nov 14, 2011 at 8:52 PM, Anshul AGARWAL
anshul.agarwa...@gmail.com wrote:
i m try to increase current floor c by push up button until it equal or
greater than g and increase co-responding push p.when my current
floor is greater than g.i push down button once
http://www.spoj.pl/problems/POUR1/
hw the 2nd given test is correct.
2
3
4
first we fill 3 littre jar with water and put into 4 littre jar den
again fill 3 littre and pour it in 2 littre remaining water in jar is
1 littre put it into 4 littre and we can measure 4 littre of water den
why answer is
check this test case
i/p
2 1 5
1 9
0
o/p
9
your code gives 12...
--
Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
http://gplus.to/amolsharma99
http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99
hi see the logic all the factors of a number are evenly distributed about
it's square root
for e.g 100
1 X 100
2 X 50
4 X 25
5 X 20
10 X 10
AFTER THIS THE PAIRS REPEATE THEMSELVES BUT IN OPPOSITE ORDER
20 X 5
25 X 4
50 X 2
100 X 1
SO IF YOU MAKE YOUR LOOP GO TO SQRT(N) AND IF YOU FIND A FACTOR OF
it can be simply done in O(sqrt(n))
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
I am trying to submit solution for the SPOJ
DIVSUMhttps://www.spoj.pl/problems/DIVSUM/problem, but it returns the
*time limit exceeded*. Code submitted by me is below:
#include cstdlib
#include iostream
using namespace std;
int proper_divisor(int number);
int main()
{
int test,i,number;
@gaurav Thanks dear
Could you please explain the algorithm.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/TNa8UygkzGkJ.
To post to this group, send
Yeah, sorry I was giving a hint for DIVSUM2, which is a much harder
version of DIVSUM.
You are checking all numbers less than n for divisibility. This is O(n).
Figure out how can you find the set of divisors using primes. This can
be done in O(2^d), if there are d prime divisors.
On Sat, Aug
Hi everybody,
I am trying to solve the below mentioned SPOJ problem. I am not getting that
how it returns *11 56 *in 3rd test.
SPOJ Problem: http://www.spoj.pl/problems/CMPLS/
Sincerely,
Rahul Verma
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
Does anyone know how to simplify the expression for this problem ?
https://www.spoj.pl/problems/EXFOR/ To get AC for this problem we can always
solve the expression, which is bruteforce, any other better way ?
Mathematician's way ?
--
You received this message because you are subscribed to the
It forms a pattern for each combination i solved it tht way in spoj.
On 7/24/11, shady sinv...@gmail.com wrote:
Does anyone know how to simplify the expression for this problem ?
https://www.spoj.pl/problems/EXFOR/ To get AC for this problem we can always
solve the expression, which is
I'm trying to solve this problem: www.spoj.pl/problems/TAILS
I tried of eliminating 1's from left to right and from right to left
and printed the minimum among them.
I got WA. Any other ideas to proceed this problem?
--
You received this message because you are subscribed to the Google Groups
Hi,
I am solving this http://www.spoj.pl/problems/DP/ problem using Djikstra's
algorithm. What is the dynamic programming solution to this ?
PS : Don't post the code, but the states of dp.
Thanks.
Shady
--
You received this message because you are subscribed to the Google Groups
Algorithm
I am getting WA for this problem.I dont know whether its case of overflow or
I have come up with a wrong formula, https://www.spoj.pl/problems/CHAIR/
I am coding in python so I dont think there is probblem of overflow.
def f(n):
if n0:
return 0
if n==0:
return 1
i=n
@above Better you ask it on spoj forum
On Sun, Jun 19, 2011 at 7:27 PM, saurabh singh saurab...@gmail.com wrote:
I am getting WA for this problem.I dont know whether its case of overflow
or I have come up with a wrong formula,
https://www.spoj.pl/problems/CHAIR/
I am coding in python so I
The final sequence should be (0,0),(1,1),(2,3),(3,5),(5,8)...
(0,0) and (0,1) both finishes in 0 iteration.
(1,2)-(0,1) and (1,1)-(0,1) both finishes in 1 iteration.
So (0,1) and (1,2) is discarded.
For the rest: (0,1) - (1,2) - (2,3) - (3,5) - (5,8) - ...
finishes in:
Link : https://www.spoj.pl/problems/ACODE/
25114
BEAN’, ‘BEAAD’, ‘YAAD’, ‘YAN’, ‘YKD’ ‘BEKD’.
How many different decodings?”
My soln , but i get TLE.Please help.
#include iostream
#include cstdio
#include vector
using namespace std;
char * head;
int result[5001];
int count(char * a ,int size)
hey me getting wrong ans..can anyone pls help me out
here s my code
#includestdio.h
#includeiostream
#includestring
#includecstring
using namespace std;
unsigned long long a[5001]={0};
unsigned long long fun(string s,int n)
{
if(n==0) return 1;
if(a[n]) return a[n];
int c=0,d=0;
even if the left over string length is 1 so that the recursion can be
fun(s,current_position-2), u still have the option for choosing a single
character... do u get it??
thats where u go wrong... :) the rec call should be return
fun(cur_length-1)+fun(cur_len-2) ...
On Wed, Jun 1, 2011 at 3:34
oops.. :P that an if didnt notice tat :D
On Wed, Jun 1, 2011 at 8:34 PM, keyan karthi keyankarthi1...@gmail.comwrote:
even if the left over string length is 1 so that the recursion can be
fun(s,current_position-2), u still have the option for choosing a single
character... do u get it??
Code::Blocks
On Sun, May 29, 2011 at 1:59 AM, Akash Mukherjee akash...@gmail.com wrote:
devcpp
On Sat, May 28, 2011 at 11:17 PM, sravanreddy001 sravanreddy...@gmail.com
wrote:
Hi all. Can some one provide a good C editor.. preferable GUI one, that
works on windows 7.
I'm good with
My code gives TLE. What further optimization is required in my code??
https://www.spoj.pl/problems/FACVSPOW/
/*FACVSPOW*/
#includestdio.h
#includecmath
using namespace std;
int calc(long n, long a)
{
if(((n*log(n)-n)+0.5*log(2*M_PI*n)-n*log(a))=0)
return 1;
else return -1;
}
int main()
{
Precompute the values. and then do queries.
On Sat, May 28, 2011 at 1:46 AM, Akshata Sharma
akshatasharm...@gmail.comwrote:
My code gives TLE. What further optimization is required in my code??
https://www.spoj.pl/problems/FACVSPOW/
/*FACVSPOW*/
#includestdio.h
#includecmath
using
follow what Akash said..!!
in case you still need help just go through http://ideone.com/al0U0 in
devcpp..!!
On Sat, May 28, 2011 at 2:34 PM, Aakash Johari aakashj@gmail.comwrote:
Precompute the values. and then do queries.
On Sat, May 28, 2011 at 1:46 AM, Akshata Sharma
@sukhmeetyour code is having runtime error !!
On Sat, May 28, 2011 at 4:48 AM, sukhmeet singh sukhmeet2...@gmail.comwrote:
follow what Akash said..!!
in case you still need help just go through http://ideone.com/al0U0 in
devcpp..!!
On Sat, May 28, 2011 at 2:34 PM, Aakash Johari
don't see the online compiler.. it doesn't allow such a large array.. try on
LINUX..
this is the one I got a/c on SPOJ ..!! http://ideone.com/NdBYJ
On Sat, May 28, 2011 at 5:26 PM, Logic King crazy.logic.k...@gmail.comwrote:
@sukhmeetyour code is having runtime error !!
On Sat, May 28,
thanks all :)
On Sat, May 28, 2011 at 8:08 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:
don't see the online compiler.. it doesn't allow such a large array.. try
on LINUX..
this is the one I got a/c on SPOJ ..!! http://ideone.com/NdBYJ
On Sat, May 28, 2011 at 5:26 PM, Logic King
Hi all. Can some one provide a good C editor.. preferable GUI one, that
works on windows 7.
I'm good with Java, but. now would like to get some hands on C, C++
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
@tec: the sequence should be like (0,1),(1,1),(1,2),(2,3),(3,5),(5,8)... or
m i wrong?
On Mon, May 23, 2011 at 11:08 AM, Aakash Johari aakashj@gmail.comwrote:
Matrix exponentiation can help i think
On Sun, May 22, 2011 at 10:36 PM, Akshata Sharma
akshatasharm...@gmail.com wrote:
It
@akshata,
The (1,1) would be a special case.
for give N=1, but again for N=1, (2,1) also satisfies well.
And the series from then is constructed on the (1,0), (2,1), (3,2) So and
so..
Also if you see in the original problem statement, they mentioned a=b, but
not ab..
this is for the special
There is also another special case.. where N=0, in this case.. its (0,0)
-- 0+0 = 0
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email
@sravanreddy001
suppose u have to calulate A^n u can calculate in O(d^3*log(n));
d is dimesion of matrixl
while (n)
{
if (n1) mul(ans, A, d);
mul(A, A, d);
n =1;
}
--
Anshuman Mishra
IIIT Allahabad
-
@sravanreddy001
by matrix exponential method, we can calculate the nth fibonacci number in
logarithmic time.
On Mon, May 23, 2011 at 7:39 PM, anshu mishra anshumishra6...@gmail.comwrote:
@sravanreddy001
suppose u have to calulate A^n u can calculate in O(d^3*log(n));
d is dimesion of matrixl
@akshata, sravanreddy: yes, for more info regarding matrix expo. you can go
through http://zobayer.blogspot.com/2010/11/matrix-exponentiation.html
On Mon, May 23, 2011 at 7:28 AM, Akshata Sharma
akshatasharm...@gmail.comwrote:
@sravanreddy001
by matrix exponential method, we can calculate the
we can use the following formula to calculate the nth fibonacci no. in O(log
n) time : fib(n)=round((pow(phi,n))/sqrt(5) + 1/2) where phi=(1+sqrt(5))/2;
And by taking care of the special cases and by using the fact that the problem
is just to find the (N+3)th fibonacci number for given N, we
Hey,
Can anyone tell how to solve this problem in Spoj ? I went through
some material but there all they were discussing was on complexity and
not on actual number of iterations.
http://www.spoj.pl/problems/MAIN74/
Thanks.
--
You received this message because you are subscribed to the Google
Try thinking backwards.
(0,1),(1,2),(2,3),(3,5),(5,8),(8,13),...
2011/5/22 shady sinv...@gmail.com:
Hey,
Can anyone tell how to solve this problem in Spoj ? I went through
some material but there all they were discussing was on complexity and
not on actual number of iterations.
It appers that the problem is just to find the (N+3)th fibonacci number for
given N. Since N is very large, how to find nth fibonaci number for such a
large n??
On Mon, May 23, 2011 at 7:51 AM, tec technic@gmail.com wrote:
Try thinking backwards.
(0,1),(1,2),(2,3),(3,5),(5,8),(8,13),...
Matrix exponentiation can help i think
On Sun, May 22, 2011 at 10:36 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
It appers that the problem is just to find the (N+3)th fibonacci number for
given N. Since N is very large, how to find nth fibonaci number for such a
large n??
On Mon,
Hey guys , I am getting wrong answer in :
http://www.spoj.pl/problems/HASHIT/. Somebdy plz check it out or provide
some test cases. This code works fine with the test cases provided and even
my own test cases.
The following is my code:
#includestdio.h
#includestring.h
int main()
{
int
I m getting WA in this question though all the test cases are giving correct
output. Link to the problem : https://www.spoj.pl/problems/PALIN/
Can anybdy check out my code . The following is my code :
#includestdio.h
#includestring.h
int compare(char s[], char t[])
{
//only check second
Bharath can u tell me how u came with the combine function ??? I can't
understand the logic behind it ... do reply
On Wed, Mar 16, 2011 at 10:24 PM, Bharath 2009503507 CSE
bharathgo...@gmail.com wrote:
i am new to segment trees..i tried this problem in spoj..
i already mentioned the link where i got this approach..
//from spoj forum
I have tried this problem with the following approach:-
1. any expression can be expressed as ))...)+a_correct_expression+((...(
2.at each node i am storing 1.no_of ')' at start and 2.no_of '(' at end of
expression that
try using precomputation in a better way ...this got me AC.. rest is just
binary search function ...!!!
On Thu, Mar 24, 2011 at 9:06 PM, .bashrc saurab...@gmail.com wrote:
Has anyone solved this problem-https://www.spoj.pl/problems/FACVSPOW/
I am getting TLE using binary search.
Thanks in
I am very sorry but i dont think i got your point.You suggesting
interpolation?
Kindly suggest some reference for good precomputation techniques..
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Has anyone solved this problem-https://www.spoj.pl/problems/FACVSPOW/
I am getting TLE using binary search.
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To
@anurag accor to me the output must be YES, correct me if I am wrong
On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan bharathgo...@gmail.comwrote:
i thot tat i had some mistake in my code and typed it all over again..
finally i noticed this :)
On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil
@murthy:no..the op must be NOits not a valid expression..read the two
conditions for a valid expression..
On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com
murthy.krishn...@gmail.com wrote:
@anurag accor to me the output must be YES, correct me if I am wrong
On Sun, Mar 20,
@bharath yaa now I got the ques, thanx :-)
On Mon, Mar 21, 2011 at 4:47 AM, bharath kannan bharathgo...@gmail.comwrote:
@murthy:no..the op must be NOits not a valid expression..read the two
conditions for a valid expression..
On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com
@krishna - yeah as Bharath said that case should give NO , anyways you got
it now :)
On Mon, Mar 21, 2011 at 5:50 AM, murthy.krishn...@gmail.com
murthy.krishn...@gmail.com wrote:
@bharath yaa now I got the ques, thanx :-)
On Mon, Mar 21, 2011 at 4:47 AM, bharath kannan
Thanks 2 all
On Mon, Mar 21, 2011 at 9:19 AM, Anurag atri anu.anurag@gmail.comwrote:
@krishna - yeah as Bharath said that case should give NO , anyways you got
it now :)
On Mon, Mar 21, 2011 at 5:50 AM, murthy.krishn...@gmail.com
murthy.krishn...@gmail.com wrote:
@bharath yaa now I
Here is my code for TRICOUNT problem
//http://www.spoj.pl/problems/TRICOUNT/
//cegprak...@gmail.com
#includeiostream
#includeconio.h
using namespace std;
unsigned long long start,end,arr[101],arr2[101];
//number of triangles facing upwards=arr
//number of triangles facing downwards=arr2
may be u can try to find a more general formula for the series..which just
depends on 'n'...
On Sat, Mar 19, 2011 at 11:48 PM, cegprakash cegprak...@gmail.com wrote:
Here is my code for TRICOUNT problem
//http://www.spoj.pl/problems/TRICOUNT/
//cegprak...@gmail.com
#includeiostream
i thot tat i had some mistake in my code and typed it all over again..
finally i noticed this :)
On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:
Hey..
I also got into same trouble today...
I submitted it 6 times..then got bored and de moralised cause i cudnt find
The problem goes like this :
Peter wants to generate some prime numbers. Your task is to generate
all prime numbers between two given numbers!
Input
The input begins with the number t of test cases in a single line
(t=10). In each of the next t lines there are two numbers m and n (1
= m = n =
you should try sieve of eratosthenes
http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
there are far more efficient algorithms but i think this shoild be a good
one to start with . ( even i got AC with this one :) )
On Fri, Mar 18, 2011 at 10:11 PM, samby ankitsamb...@gmail.com wrote:
The
Hey..
I also got into same trouble today...
I submitted it 6 times..then got bored and de moralised cause i cudnt find
flaw in code...
When i read your mail and corresponding sorry mail...it just struck me..I
also had to print YES and NOand i was printing NO as NoIt
got ac den...
:P
thnx
sorry guyz...
Had to print YES n NO..
i printed as Yes n No...
Got ac..
Sorry for the trouble..
On Wed, Mar 16, 2011 at 10:24 PM, Bharath 2009503507 CSE
bharathgo...@gmail.com wrote:
i am new to segment trees..i tried this problem in spoj..
http://www.spoj.pl/problems/BRCKTS
am getting WA..
i am new to segment trees..i tried this problem in spoj..
http://www.spoj.pl/problems/BRCKTS
am getting WA..
pls help...
code:
#includeiostream
#includevector
#includecstdio
#includecmath
#includestring
using namespace std;
class pi
{
public:
int a,b;
pi()
well i have a doubt the test case says number could be as large as
10 and you have taken int but int does not have such range then how
it is accepted
On Sat, Mar 12, 2011 at 7:57 PM, Logic King crazy.logic.k...@gmail.comwrote:
Here is my solution.i got it AC
#includestdio.h
int
i Agree.the test cases for which problem is being jugdged might not have
those larger values.
On Tue, Mar 15, 2011 at 12:20 PM, UTKARSH SRIVASTAV usrivastav...@gmail.com
wrote:
well i have a doubt the test case says number could be as large as
10 and you have taken int but
@utraksh : 10^9 is well in int limits
On Tue, Mar 15, 2011 at 12:56 PM, Satyam Kapoor satyamkapoo...@gmail.comwrote:
@utkarsh:teri kismat acchi thi aur kuch nhimaze kar!
---
Satyam Kapoor
B.Tech-2nd Year
MNNIT-Allahabad.
--
You received this message because
It fails for input 1,2,3. I think there needs to be one more iteration to
check if the candidate is actually a majority element or not.
Thanks,
Balaji.
On Tue, Mar 15, 2011 at 9:50 PM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:
CAN ANYONE PLEASE TELL ME WHY MY CODE IS GIVING WRONG
hey link to the problem??
On Tue, Mar 15, 2011 at 10:50 PM, Balaji Ramani
rbalaji.psgt...@gmail.comwrote:
It fails for input 1,2,3. I think there needs to be one more iteration to
check if the candidate is actually a majority element or not.
Thanks,
Balaji.
On Tue, Mar 15, 2011 at 9:50
http://www.spoj.pl/problems/MAJOR/
http://www.spoj.pl/problems/MAJOR/Thanks,
Balaji.
On Tue, Mar 15, 2011 at 11:00 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
hey link to the problem??
On Tue, Mar 15, 2011 at 10:50 PM, Balaji Ramani rbalaji.psgt...@gmail.com
wrote:
It fails for
tahnks balaji i have got ac in this problem my prog is same only in
the end i have taken a loop and
@ akshata the link for the prob is https://www.spoj.pl/problems/MAJOR/
MY CODE IS
#includestdio.h
main()
{
long long int n,t,r[100],count,major,i;
scanf(%lld,t);
while(t--)
{
1 - 100 of 155 matches
Mail list logo