Search found 11 matches

by pankaj trivedi
Fri Oct 20, 2006 9:41 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 182001

Dont create new thread for the existing ones. Your problem has been discussed in the existing thread. anyways you need to print the output in the order it is given in input
by pankaj trivedi
Mon Oct 09, 2006 9:07 pm
Forum: Volume 6 (600-699)
Topic: 612 - DNA Sorting
Replies: 122
Views: 16029

You did not empty the vector a . You need to erase the vector when it is of no use . so at the end of loop you can use a.erase(a.begin() ,a.end()) Even if you overcome with the wrong answer you code will result in TLE because of n^2 bubble sort so think of some other efficient method for sorting lik...
by pankaj trivedi
Thu Oct 05, 2006 6:45 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 182001

We already have threads for this problem , you will get your problem solved there ,please search before creating a new thread


BTW, Your program will not compile and there are errors in logic too . Read the problem statement carefully and use gnu/g++ compiler.
by pankaj trivedi
Wed Oct 04, 2006 7:18 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 182001

a can be greater than b ,so consider that case also

input:

Code: Select all

20 10
your output:

Code: Select all

20 10 0
which is wrong.

btw, dont create new thread for existing one.
you can search before posting .
by pankaj trivedi
Wed Oct 04, 2006 11:15 am
Forum: Volume 3 (300-399)
Topic: 337 - Interpreting Control Sequences
Replies: 20
Views: 4240

My accepted code gives the following output for your input: Case 1 +----------+ |123^ 45 | | | | | | | | | |^ ^45 ^ | | | | | | | |hello | +----------+ Case 2 +----------+ |123^ 450 | | | | | | | | | |^ ^45 ^ | | | | | | | |hello | +----------+
by pankaj trivedi
Wed Oct 04, 2006 8:17 am
Forum: Volume 3 (300-399)
Topic: 337 - Interpreting Control Sequences
Replies: 20
Views: 4240

If you need output for some of your inputs ,I can provide it to you.
by pankaj trivedi
Tue Oct 03, 2006 9:56 pm
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 22552

Yeah It is 0
by pankaj trivedi
Tue Oct 03, 2006 4:51 pm
Forum: Volume 4 (400-499)
Topic: 412 - Pi
Replies: 104
Views: 17898

Though i am not very sure about your question. Are you looking for this

Code: Select all

#include<iostream>
#include<iomanip>
using namespace std;
main()
{

float x=3;
cout.setf(ios::fixed, ios::floatfield);
cout.precision(7);
cout<<x;
}
by pankaj trivedi
Tue Oct 03, 2006 3:09 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 182001

input:

Code: Select all

1 2 
2 1
Your output:

Code: Select all

1 2 2 
1 2 2 
but output should be:

Code: Select all

1 2 2 
2 1 2 

so order of a and b should remain same
by pankaj trivedi
Tue Oct 03, 2006 10:49 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 182001

Your program gives :


input:

Code: Select all

1 1 
1 2
1 3
1 4


output:

Code: Select all

1 1 3 
1 2 3
1 3 7
1 4 7
which is wrong

correct output for the above input should be:

Code: Select all

1 1 1
1 2 2
1 3 8
1 4 8
by pankaj trivedi
Mon Jul 10, 2006 11:04 pm
Forum: Volume 100 (10000-10099)
Topic: 10070 - Leap Year or Not Leap Year and ...
Replies: 233
Views: 53598

WA

here is my code ..i m getting WA ...please help!! :( #include<iostream> #include<cmath> #include<string> using namespace std; bool four(string s) { int n=s.length(); int a,b,c; a=s[n-1]-'0'; b=s[n-2]-'0'; c=10*b+a; if(c%4==0) return true; else return false; } bool five(string s) { int n=s.length(); ...

Go to advanced search