Search found 2 matches

by brock
Sat Jan 03, 2009 6:13 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320261

100: time exceeded

how can i reduce the time in the 3n+1 problem!!!!

#include<iostream>
#include<vector>
using namespace std;
int main(){
int test=0;
long int x,y,count,i,old;
long long int j;
// double j;
vector<long int>v;
while(cin>>x>>y){
if(x>y){
swap(x,y);
test=1;
}
for(i=x;i<=y;i++){
// cout<<i ...
by brock
Sat Jan 03, 2009 2:34 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320261

100 : Wrong Answer

//i dont get y am i getting a wrong answer in this code
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int max(int a,int b){
if(a>b)
return a;
else
return b;
}
int main(){
int n,i=0,j,n1,t,f,l,temp=1,check=0;

while(cin>>f>>l){
if(f>l){
check=1;
swap(f,l ...

Go to advanced search