Vcoderz Community
We create websites that have it all, beauty & brains
Lebanon Web Design & Development - Coddict
 

Go Back   Vcoderz Community > Community Forums > Vcoderz Lobby

Notices

Vcoderz Lobby « Everything and everywhere. »

Reply
 
Share Thread Tools Search this Thread
Old 01-31-2010   #261
Neoxter
Beyond the Code
 
Neoxter's Avatar
 
Last Online: 06-15-2014
Join Date: Sep 2008
Posts: 2,993
Thanks: 2,214
Thanked 3,426 Times in 1,499 Posts
Groans: 57
Groaned at 69 Times in 52 Posts
Default

Thanks Google

EDIT: Show us how did u solve it


__________________
Whatever you do, do it for the Lulz.

Last edited by Neoxter; 01-31-2010 at 09:30 PM.
Neoxter is offline   Reply With Quote
Old 01-31-2010   #262
Tawa
 
Tawa's Avatar
 
Last Online: 12-20-2021
Join Date: Mar 2006
Posts: 6,245
Thanks: 2,121
Thanked 3,365 Times in 1,740 Posts
Groans: 29
Groaned at 44 Times in 35 Posts
Default

Quote:
Originally Posted by Neoxter View Post
Thanks Google

EDIT: Show us how did u solve it
Code:
#include <iostream>
using namespace std;

bool f(float);

int main(){
    long i;
    float a;
    for(i = 0; i < 10000; i++){
        a = (float)i;
        if(f(a/6) && f(a/7) && f(a/8) && f(a/9) && f(a/10))
            cout << "I = " << i << endl;
    }
}

bool f(float a){
    int b = a;
    return (a==b);
}
This is how I figured it out
__________________
What we do in life, echoes in eternity.
Tawa is offline   Reply With Quote
Old 01-31-2010   #263
Kingroudy
Super Moderator
 
Kingroudy's Avatar
 
Last Online: 02-16-2022
Join Date: May 2006
Posts: 5,580
Thanks: 1,888
Thanked 2,653 Times in 1,593 Posts
Groans: 55
Groaned at 35 Times in 32 Posts
Default

don't you dare to question my IQ and claim that i used google.
to form 2,4,8 you need (2,2,2)
to form a 9 u need (3,3)
to form a 7 you need a (7)
to form a 5 you need a (5)
to form a 6 u need nothing because you already have 3 and 2
to form a 10 u need nothing because you already have 5 and 2
you don't need a 1 do you
so the answer is 2*2*2*3*3*5*7
__________________
click on 'Groan' to switch to my left testicle.
Kingroudy is offline   Reply With Quote
The Following User Says Thank You to Kingroudy For This Useful Post:
Neoxter (01-31-2010)
Old 01-31-2010   #264
Tawa
 
Tawa's Avatar
 
Last Online: 12-20-2021
Join Date: Mar 2006
Posts: 6,245
Thanks: 2,121
Thanked 3,365 Times in 1,740 Posts
Groans: 29
Groaned at 44 Times in 35 Posts
Default

Code:
#include <iostream>
using namespace std;

bool f(float);

int main(){
    long i;
    int max;
    bool display;

    cout << "The number should be divisible by all digits from 1 to ";
    cin >> max;
    for(i = 1; i < 100000000; i++){
        display = true;
        for(int j = 1; j <= max; j++){
            if(!f((float)i/j))
                display = false;
        }
        if(display){
            cout << "I = " << i << endl;
            break;
        }
        else
            cout << i << "\x8\x8\x8\x8\x8\x8";
    }
    if(display)
        cout << "Done!" << endl;
    else
        cout << "Failed!" << endl;

    return 0;
}

bool f(float a){
    int b = a;
    return (a==b);
}

Compile this one

Note: the execution might be very slow if you use a large number.
__________________
What we do in life, echoes in eternity.
Tawa is offline   Reply With Quote
The Following User Says Thank You to Tawa For This Useful Post:
Neoxter (01-31-2010)
Old 02-02-2010   #265
Google

 
Google's Avatar
 
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
Default

@Tawa, your algorithm can be enhanced.
Instead of calling the stupid "f" function I don't know how much times, you could just use the modulus operator like this: if(i%j != 0)
instead of: if(!f((float)i/j))
As for the "Decore", no need for "\x8\x8\x8\x8\x8\x8", \r will do the job.
__________________

Google is offline   Reply With Quote
The Following User Says Thank You to Google For This Useful Post:
Tawa (02-02-2010)
Old 02-02-2010   #266
Google

 
Google's Avatar
 
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
Default

Quote:
Originally Posted by Kingroudy View Post
don't you dare to question my IQ and claim that i used google.
to form 2,4,8 you need (2,2,2)
to form a 9 u need (3,3)
to form a 7 you need a (7)
to form a 5 you need a (5)
to form a 6 u need nothing because you already have 3 and 2
to form a 10 u need nothing because you already have 5 and 2
you don't need a 1 do you
so the answer is 2*2*2*3*3*5*7
An AI bot can be taught to think this way. Unlike the brute force method of Tawa that is expensive in terms of resources.
__________________

Google is offline   Reply With Quote
Old 02-02-2010   #267
Kingroudy
Super Moderator
 
Kingroudy's Avatar
 
Last Online: 02-16-2022
Join Date: May 2006
Posts: 5,580
Thanks: 1,888
Thanked 2,653 Times in 1,593 Posts
Groans: 55
Groaned at 35 Times in 32 Posts
Default

Quote:
Originally Posted by Google View Post
An AI bot can be taught to think this way. Unlike the brute force method of Tawa that is expensive in terms of resources.
i'm an android LOL
__________________
click on 'Groan' to switch to my left testicle.
Kingroudy is offline   Reply With Quote
Reply

  Vcoderz Community > Community Forums > Vcoderz Lobby

Tags
maths, riddle



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:32 PM.


Lebanon web design and development
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Share