Home > front end >  Can't understand the requirement from the exercise
Can't understand the requirement from the exercise

Time:02-05

this https://projecteuler.net/problem=641 is the problem I am trying to solve and below is my half solution.

void dice(int n) 
{
    int i, j, dices[n];

    for(i = 0; i < n; i  ) {
        dices[i] = 1;
    }

    for(i = 1; i < n; i  ) 
    {
        for(j = 0; j < n; j =i)
        {
             dices[j]= dices[j] > 5?1:dices[j] 1;
        }
    };


    for(i = 0; i < n; i  ) {
        cout << i 1 <<  "th dice is :" << dices[i] << endl;
    }
};

this is the part I do not get: Let f(n) be the number of dice that are showing a 1 when the process finishes. You are given f(100)=2 and f(10^8)=69. Find f(10^36).

from "f(100)=2" I understand that the 100th die should be 2 but f(10^8)=69 loses me.

CodePudding user response:

Read the problem description again. There is a definition of f() there:

Let f(n) be the number of dice that are showing a 1 when the process finishes.

It is not a value of any specific die. Instead, the value of f(n) tells you how many dice in the n–dice row show 1 after completion of all turns.

  •  Tags:  
  • Related