Jump to content

no...

if the point of the problem is to solve something using code, solving it yourself and inputting the answer so that the code prints it is not making the code solve the problem

The point wasn't to solve it in a certain way. The point was just to solve it in a programming language.

It just shows that it's a bad programming problem.

 

And there is no input.

The solution is global, it's actually there , somewhere in the executable file, where the program reserves a certain space for an integer and sets it to the value 81.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

The point wasn't to solve it in a certain way. The point was just to solve it in a programming language.

It just shows that it's a bad programming problem.

 

And there is no input.

The solution is global, it's actually there , somewhere in the executable file, where the program reserves a certain space for an integer and sets it to the value 81.

but the program is still not solving anything...

the human is the one solving it

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

but the program is still not solving anything...

the human is the one solving it

How is it not doing exactly what it has to do?

#include <fstream>ofstream out("output.out")int main(){    std::out << 81;    return 0;}

If that program is run , it will write in the output file all the numbers with that property.

No human. All computer.

 

Do you miss what the problem was trying to teach ? Yes probably. But then again, you missing the point and the fact that this solution is way more efficient just proves that it's a bad problem.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

How is it not doing exactly what it has to do?

#include <fstream>ofstream out("output.out")int main(){    std::out << 81;    return 0;}

If that program is run , it will write in the output file all the numbers with that property.

No human. All computer.

 

Do you miss what the problem was trying to teach ? Yes probably. But then again, you missing the point and the fact that this solution is way more efficient just proves that it's a bad problem.

 

The program written should be the one to compute. Since you're just outputting the answer, technically, your "solution" is wrong. :)

CPU: Intel i5-4590 | Motherboard: Asus H97M-E | GPU: Sapphire Nitro R9 390 | RAM: 2x4Gb Kingston HyperX Fury Black | SSD: Sandisk Plus 240Gb HDD: Seagate 250Gb  | PSU: Seasonic G650 80+ Gold | Case: NZXT S340

I am who I am.

Link to post
Share on other sites

How is it not doing exactly what it has to do?

#include <fstream>ofstream out("output.out")int main(){    std::out << 81;    return 0;}

If that program is run , it will write in the output file all the numbers with that property.

No human. All computer.

 

Do you miss what the problem was trying to teach ? Yes probably. But then again, you missing the point and the fact that this solution is way more efficient just proves that it's a bad problem.

No, that's you solving it and just hardcoding an answer. 

 

Here's an actual solution: 

 

That wouldn't teach the same lesson (which was presumably bit shifting -- or being lazy and just separating numbers). (albeit there are definitely better ways to teach the same lesson...but whatever)

int main(int argc, char ** argv){    int x = 0, y=0;    for(int i=10 ; i<100; i++){ //yes, I could do something a bit more complex that will                                 //calculate the length of the number, but I'm lazy           x = i/10;           y = (i % x*10)/10;           if((x+y)*(x+y) == i)                 printf("ANSWER: %d\n", i);    }    return 0; }

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to post
Share on other sites

How is it not doing exactly what it has to do?

If that program is run , it will write in the output file all the numbers with that property.

No human. All computer.

 

Do you miss what the problem was trying to teach ? Yes probably. But then again, you missing the point and the fact that this solution is way more efficient just proves that it's a bad problem.

 

Why is this concept of a "problem" so difficult for you to comprehend??

If it already has the answer hardcoded into it, it does 0 solving.

There is no "problem" if it already has the solution.

There is no solving for an answer if it has the solution.

This solution was already found by a human and hardcoded into the program.

Do you not get the point?

 

Programs that are supposed to solve things CANNOT have the answer hardcoded. Otherwise there is nothing to solve and there is no problem, therefore the program is not finding a solution on its own.

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

Why is this concept of a "problem" so difficult for you to comprehend??

If it already has the answer hardcoded into it, it does 0 solving.

There is no "problem" if it already has the solution.

There is no solving for an answer if it has the solution.

This solution was already found by a human and hardcoded into the program.

Do you not get the point?

 

Programs that are supposed to solve things CANNOT have the answer hardcoded. Otherwise there is nothing to solve and there is no problem, therefore the program is not finding a solution on its own.

The problem in question does not necessarily involve solving the search for all the numbers with that propriety. The purpose is to print them.

And yes, exactly. Why is this a problem?

I've been to programming contests quite a lot. I've encountered a few problems which I can recall and in which the answer could be hardcoded , and the 100% solution was to use that hardcoded answer. Is it ugly? Of course. Then there are the problems which are solved with formulas , which I encountered quite a lot , and those are pretty bad as well. Still , does it make it a non-valid problem? It still makes you think. The purpose of those contests is for you to solve the given problem using the tools offered by a computer , and of course, your own.

And then comes the term of "solving" . What does it mean? Finding the answer of course, but how?

What can you , as a person do?

Can you use mathematical proprieties?

Can you use and design algorithms?

Because, if solving just represented the guided instructions which the computer does, I'd rather call it "execution". You figuring out an algorithm to solve a problem, that's what I would call solving it. The computer then just executes the instructions you offered and gives you the solution.

 

Still, if this problem was "Solve the problem of etc. etc. by doing that, and that, and etc. etc. ." then it would have made more sense. It just isn't a good programming problem. The things it tries to teach are best thought by other problems , and a faster and more efficient solution can be hardcoded.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

 

go to ANY programming course, test, class, competition, etc...

a hardcoded answer will get you 0

 

hardcoding an answer makes you learn NOTHING

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

hardcoding an answer makes you learn NOTHING

At least we agree on that. :D

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

go to ANY programming course, test, class, competition, etc...

a hardcoded answer will get you 0

hardcoding an answer makes you learn NOTHING

a good problem either CANT be hard coded or would take more lines of code to print all the possibilities than to produce an algorithm. The most efficient route is often with an algorithm but if there is only one possible output then a hard coded output is fine. To print hello world, the program doesn't first create an array where all possible 11 character sequences are represented then search for one that fits the criteria. No, there is only one possible output.

A hard coded answer doesn't produce a score of 0. Because the output is the same and (in this case) is more efficient. Hard coding is fine for very limited possibility problems.

In terms of learning from it, you should learn that a complex algorithm isn't always (but mostly is) the most efficient method.

When cleaning up code, one of the first things I do is simplify sections that do this.

"Physics is like sex: sure, it may give some practical results, but that's not why we do it." Richard Fynman

Link to post
Share on other sites

 

a good problem either CANT be hard coded or would take more lines of code to print all the possibilities than to produce an algorithm. The most efficient route is often with an algorithm but if there is only one possible output then a hard coded output is fine. To print hello world, the program doesn't first create an array where all possible 11 character sequences are represented then search for one that fits the criteria. No, there is only one possible output.

A hard coded answer doesn't produce a score of 0. Because the output is the same and (in this case) is more efficient. Hard coding is fine for very limited possibility problems.

In terms of learning from it, you should learn that a complex algorithm isn't always (but mostly is) the most efficient method.

 

At least we agree on that. :D

ok good, because I think the point of that computer program was to solve a math equation not learn how to print a number

 

so technically that is the wrong solution, because when making computer programs not only do you need to get the right answer, but the process to get the answer also needs to be correct

and the process in this case is making a loop to test numbers until it finds the correct value, right?

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

I think that is where we disagree.

So in English class you would just write down the thesis?

And in Math you just write down the answer?

 

That's not how it works.

Education =/= multiple choice test

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

So in English class you would just write down the thesis?

And in Math you just write down the answer?

That's not how it works.

Education =/= multiple choice test

the code is the answer in programming. thought process (working) comes from documentation, planning, testing schedule, code comments. How you reach the solution.

"Physics is like sex: sure, it may give some practical results, but that's not why we do it." Richard Fynman

Link to post
Share on other sites

the code is the answer in programming. thought process (working) comes from documentation, planning, testing schedule, code comments. How you reach the solution.

yeah, so making a hardcoded answer is wrong because there is no process to solving the problem using code

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

yeah, so making a hardcoded answer is wrong because there is no process to solving the problem using code

no, you don't understand. To get a good mark in a education setting, he would have to show how he realised that there was only one output, and explain why he used the certain code peices. Also how he test boundary, expected and unexpected inputs (if relevant) .

Also show his planning with different algorithms and why he stuck with this one.

"Physics is like sex: sure, it may give some practical results, but that's not why we do it." Richard Fynman

Link to post
Share on other sites

ok good, because I think the point of that computer program was to solve a math equation not learn how to print a number

 

so technically that is the wrong solution, because when making computer programs not only do you need to get the right answer, but the process to get the answer also needs to be correct

and the process in this case is making a loop to test numbers until it finds the correct value, right?

How do you define solving a problem then? Because you are giving the computers the exact instructions on how to solve the problem, the computer itself is just executing those instructions. But I'd say that making that algorithm is the more significant step in solving the problem. So by your way of thinking, one could argue that you would have to make a program that is able to understand the problem and able to make an algorithm to solve it itself.

GPU: Gigabyte GTX 970 G1 Gaming CPU: i5-4570 RAM: 2x4gb Crucial Ballistix Sport 1600Mhz Motherboard: ASRock Z87 Extreme3 PSU: EVGA GS 650 CPU cooler: Be quiet! Shadow Rock 2 Case: Define R5 Storage: Crucial MX100 512GB
Link to post
Share on other sites

Think of it like answering a math problem with x=(8/5)*2^2 where he could simply put x=32/5

The code isn't the working, it's the "answer"

"Physics is like sex: sure, it may give some practical results, but that's not why we do it." Richard Fynman

Link to post
Share on other sites

no, you don't understand. To get a good mark in a education setting, he would have to show how he realised that there was only one output, and explain why he used the certain code peices. Also how he test boundary, expected and unexpected inputs (if relevant) .

Also show his planning with different algorithms and why he stuck with this one.

except an "algorithm" means calculations to solve a problem

all the code is is an answer, not a problem

it solves nothing

"print 81" is not an algorithm

 

How do you define solving a problem then? Because you are giving the computers the exact instructions on how to solve the problem, the computer itself is just executing those instructions. But I'd say that making that algorithm is the more significant step in solving the problem. So by your way of thinking, one could argue that you would have to make a program that is able to understand the problem and able to make an algorithm to solve it itself.

the "problem" here is to code a program that will find values of which the square sum if its digits is equal to the number

the entire point of this is to write code that will solve a mathematical problem to find those numbers

the point is NOT to print the answer without doing anything else

 

Think of it like answering a math problem with x=(8/5)*2^2 where he could simply put x=32/5

The code isn't the working, it's the "answer"

what kind of school would give you  "solve x=(8/5)*2*2" like seriously? lol

maybe wait a few years and get some higher level education, then you will see that the process of finding the answer is what you get taught in class

 

you dont go to class and get told "x=32/5" you go to class and learn how (8/5)*2*2=32/5

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

except an "algorithm" means calculations to solve a problem

all the code is is an answer, not a problem

it solves nothing

"print 81" is not an algorithm

the "problem" here is to code a program that will find values of which the square sum if its digits is equal to the number

the entire point of this is to write code that will solve a mathematical problem to find those numbers

the point is NOT to print the answer without doing anything else

what kind of school would give you "solve x=(8/5)*2*2" like seriously? lol

maybe wait a few years and get some higher level education, then you will see that the process of finding the answer is what you get taught in class

you dont go to class and get told "x=32/5" you go to class and learn how (8/5)*2*2=32/5

I said you don't give an ANSWER as x=(8/5)*2*2, you simply before you finish. I'm in the middle of studding for my ncea level 2 calculus exam on Tuesday so please don't make this personal.

"Physics is like sex: sure, it may give some practical results, but that's not why we do it." Richard Fynman

Link to post
Share on other sites

I said you don't give an ANSWER as x=(8/5)*2*2, you simply before you finish. I'm in the middle of studding for my ncea level 2 calculus exam on Tuesday so please don't make this personal.

And this is a programming class, where the teacher is teaching how to code, not how to do a math calculation.

Why would he care if his students know the answer is 81? IT DOESNT MATTER

 

The entire point of programming class is to learn how to code, and its pretty obvious from this problem that the teacher wants the students to learn how to write a mathematical algorithm in code, NOT how to print a number

 

so that's why cout<<81 is wrong, because the point of this exercise is not to print a number, it is to use code to solve for the number

 

 

and jusy fyi, in math class they teach you how to solve equations, they dont teach you how to write down the answers to the equations

and in programming class they teach you how to code equations, not how to print the answers you already know

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

except an "algorithm" means calculations to solve a problem

all the code is is an answer, not a problem

it solves nothing

"print 81" is not an algorithm

the "problem" here is to code a program that will find values of which the square sum if its digits is equal to the number

the entire point of this is to write code that will solve a mathematical problem to find those numbers

the point is NOT to print the answer without doing anything else

what kind of school would give you "solve x=(8/5)*2*2" like seriously? lol

maybe wait a few years and get some higher level education, then you will see that the process of finding the answer is what you get taught in class

you dont go to class and get told "x=32/5" you go to class and learn how (8/5)*2*2=32/5

an algorithm is a set of instructions on how to complete a task.

The task is to create program that outputs all two digit numbers whose root is equal to the sum of the digits. This is a bad problem for programming as it can be easily solved easily with a single line.

If the teacher wanted a loop then there are plenty of other tasks/problems that could be given.

"Physics is like sex: sure, it may give some practical results, but that's not why we do it." Richard Fynman

Link to post
Share on other sites

an algorithm is a set of instructions on how to complete a task.

The task is to create program that outputs all two digit numbers whose root is equal to the sum of the digits. This is a bad problem for programming as it can be easily solved easily with a single line.

If the teacher wanted a loop then there are plenty of other tasks/problems that could be given.

uh, no, this isn't a math class, this is a programming class.

the intended purpouse of this program was to make the students learn how to code mathematical equations to solve a problem, not to type "cout<<81"

 

that would be like a math teacher teaching you how to write down the answer on a piece of paper instead of how to solve the problem

this solution is wrong because the person who wrote it learnt nothing about coding that they didn't already know

and that's not the point of school

 

the point of school is to learn, not to write down answers

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

And this is a programming class, where the teacher is teaching how to code, not how to do a math calculation.

Why would he care if his students know the answer is 81? IT DOESNT MATTER

The entire point of programming class is to learn how to code, and its pretty obvious from this problem that the teacher wants the students to learn how to write a mathematical algorithm in code, NOT how to print a number

so that's why cout<<81 is wrong, because the point of this exercise is not to print a number, it is to use code to solve for the number

and jusy fyi, in math class they teach you how to solve equations, they dont teach you how to write down the answers to the equations

and in programming class they teach you how to code equations, not how to print the answers you already know

in both they teach you use problem solving. In a coding class they teach you the tools and you must solve a problem using them. You are marked on how well you solved problems. He produced a price of code that solves the problem, and he has gone through the thought processes to solve it using a minimal amount of code. He would also gain marks for drafting a longer algorithm for solving the problem and showing that it only has a single output.

In a good programming class this wouldn't be the type of problem that you would be given often.

"Physics is like sex: sure, it may give some practical results, but that's not why we do it." Richard Fynman

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×